okay i have been trying to understand this for hours i am learning VB :
if i have this ( PageLoadComplete function / HiddenField / linkButton ) :
Protected Sub PageLoadComplete(sender As Object, e As System.EventArgs) Handles Me.LoadComplete
If Request.QueryString("viewPDF") = 1 Then
MsgBox(myfield.Value)
End If
End Sub
this link open a new tab linked to the same page (it loads the same page ) :
<asp:LinkButton runat="server" CssClass="lnkBtn" ID="btnViewPDF"
OnClientClick="var url = 'CIP_frmCIPEventExplore.aspx?ViewPDF=1;
parent.showNewTab(url, 'CIP Chart - PDF', 'CIP');">
<img alt=""src="External_Files/images/view_pdf_icon.png" />
<span>View MsgBox</span></asp:LinkButton>
and hidden field that has a value :
<asp:HiddenField ID="myfield" runat="server" Value="myfields" />
IF i click on the link it open a new tab with a MsgBox that has the HiddenField (ID=”myfield”) value which is very fine but :
if i modify this hidden field and remove it’s value like this :
<asp:HiddenField ID="myfield2" runat="server" />
and then add this value using javascript:
$("#<%=btnViewPDF.ClientID%>").click(function(){
$("#<%=myfield2.ClientID%>").val('this is the field2 val') ; ) ;
});
i get an empty MsgBox() , so how can i make the jquery update this hidden field ID=”myfield2″ before calling the PageLoadComplete function
Thanks
Well, you have two click events defined for
btnViewPDF, so they are likely conflicting with each other. Try moving the Javascript from theOnClientClickproperty into the jQueryclick()function.