开发者

Issue with OnClick event in Chrome for asp.net repeater control

I am trying to save the onclick statistics after the search results are clicked. this is how i have done in ASP.net using repeater control.

string domainName = String.Format("{0}/{1}", ConfigSettings.ReadConfigValue("DomainName"), loc.DomainName);
string statScript = 
    string.Format("UpdateDealStatistics('MerchantProfile', 'clicked'," + loc.LocationID + "," + merchantID + ",'" + x + "'," + UserID + ", 0," + "'Search Display','" + domainName + "')");                
((HtmlAnchor)e.Item.FindControl("MerchantName")).Attributes.Add("onclick", statScript);

((Literal)e.Item.FindControl("litLocName")).Text = String.Format("{0}", loc.LocationName); 
((Literal)e.Item.FindControl("litLocAdd1")).Text = loc.Address;
((Literal)e.Item.FindControl("litLocCity")).Text = loc.City;
((Literal)e.Item.FindControl("litLocState")).Text = loc.State;

aspx page:

<asp:Repeater ID="rptSearch" runat="server" OnItemDataBound="rptSearch_ItemDataBound"
    OnItemCommand="rptSearch_ItemCommand">
    <HeaderTemplate>
    </HeaderTemplate>
    <ItemTemplate>
       <td class="merchant_item_bg_blank" id="TD_Location" runat="server">
           <span class="merchant_item_head">
               <a id="MerchantName" runat="server">
                   <asp:Literal ID="litLocName" runat="server"></asp:Literal>
               </a>
           </span><br />
           <span class="merchant_items">
               <asp:Literal ID="litLocAdd1" runat="server"></asp:Literal><br />
               <asp:Literal ID="litLocCity" runat="server"></asp:Literal>,
               <asp:Literal ID="litLocState" runat="server"></asp:Literal>

UpdateDealstatistics gets updated fine for IE and Firefox except for chrome. I had spent 2 days on this.

I have no idea what is wrong in here. Please correct me. Thank you in advance!!

For more clarity:

When the link on the Search results is clicked, UpdateDealstatistics calls开发者_JS百科 a function in different page, which saves the count in database. litLocName and litLocAdd1, etc are the literals to display address of the search results.

I hope i am clear :) Thanks guys!


It seems that the link has invalid “href” attribute. Try to specify any valid “dummy” “href” attribute? Does it make a sense?

<a id="MerchantName" href="javascript:void(0)" runat="server">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜