Click here to Skip to main content
15,885,650 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys,

I have asp.net page,

where i have javascript function with three parameters.
&
i'm calling this function from a repeater.

javascript
<script type="text/javascript">
    function UpdateDiff(RegNo, ddlval, filedate) {
        $('.Display').attr('href', 'UpdateDifferences.aspx?RegNo=' + RegNo + ' &Status=' + status + ' &filedate=' + filedate + '');
        $('.Display').trigger('click');
    }
</script>


Calling from repeater
<a class="Display" href="UpdateDifferences.aspx"><asp:ImageButton ID="imgView" Visible="true" runat="server" 
                    OnClientClick='<%# String.Format("javascript:return UpdateDiff({0},{1},{2})", Eval("RegNo") , Eval("Status") , Eval("File_Date")) %>'
                       ToolTip="Edit" ImageUrl="~/images/Edit.png"
                       Width="20" Height="20" />  
                      </a>


When checked its 'inspect element' in chrome, its passing the values to the function.

i'm passing these values as query string to other page.

but on other page, i'm not getting these values.

string URL = HttpContext.Current.Request.Url.AbsolutePath;
               //System.Net.WebClient wc = new System.Net.WebClient();
               string Reg = Request.QueryString["RegNo"].ToString(); // null ref except
               string Sts = Request.QueryString["Status"].ToString();
               string fdt = Request.QueryString["filedate"].ToString();
               string data = URL + Reg + Sts + fdt;

               Response.Write(data);



PageSource View:
<a class="Display" href="UpdateDifferences.aspx"><input type="image" name="ctl00$MainContent$Repeater1$ctl01$imgView" id="MainContent_Repeater1_imgView_0" title="Edit" src="images/Edit.png" onclick="javascript:return UpdateDiff(23155,Yes,11/30/2014);" style="height:20px;width:20px;" />  
                      </a>

Can any one please check the code where the code is not correct.

Thanks
Posted

XML
how about writing code like instead of a javascript call and triggering click event :

<a class="Display" href="UpdateDifferences.aspxregNo=23155&amp;Status=Yes&filedate=11/30/2014"></a>



or

C#
<a class="Display" href="<%String.Format('UpdateDifferences.aspx?regno={0}&status={1}',Eval(RegNo),Eval(Status))%>"></a>
 
Share this answer
 
Comments
abdul subhan mohammed 20-Dec-14 11:25am    
Thanks dude...
Hi,

You may try this:

<a class="Display" href="/KB/answers/UpdateDifferences.aspx" id="Display" >

I mean class="Display" is not ID of the link, so you can not assign value to link.

Hope this help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900