Hello Everyone,
I have WebPage1.aspx and WebPage2.aspx.
Webpage1 has:
Two checkboxes (Checkbox1 and Checkbox2)
A gridview has some data and hyperlinkfield that goes to the WebPage2, there is not any checkboxes in the gridview.
WebPage2. Aspx is a simple webpage.
In the webpage1.aspx, Checkbox1 is checked and later I click the hyperlinfield in the gridview to see the webpage2. After done with the webpage2, I clicked back browser button to go back to the webpage1, but the checkedbox1 that was already checked before the postback in the webpage1 was gone after postback and I would like to know how to keep the CheckBbox1 or CheckedBox2 checked after postback.
aspx :
<asp:Label
ID="LblViewTIFPDF"
runat="server"
Text="View Document Image(s) As:"
style="margin-left : 700px"></asp:Label>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" RenderMode ="Inline" >
<ContentTemplate>
<asp:CheckBox
ID="myCheckBox1"
runat="server"
Text="TIF"
OnCheckedChanged ="TIF_OnCheckedChanged"
AutoPostBack ="true"
style="margin-left : 15px;
width : 2px" TabIndex="4" />
<cc1:MutuallyExclusiveCheckBoxExtender
ID="mecbExt1"
runat="server"
TargetControlID ="myCheckBox1"
key="YesNo">
</cc1:MutuallyExclusiveCheckBoxExtender>
</ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID =" myCheckBox1" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel3" runat="server" RenderMode ="Inline" >
<ContentTemplate>
<asp:CheckBox
ID="myCheckBox2"
runat="server"
Text="PDF"
OnCheckedChanged ="PDF_OnCheckedChanged"
AutoPostBack ="true"
style="margin-left : 55px;
width : 5px;"
TabIndex="5" />
<cc1:MutuallyExclusiveCheckBoxExtender
ID="mecbExt2"
runat="server"
TargetControlID ="myCheckBox2"
key="YesNo">
</cc1:MutuallyExclusiveCheckBoxExtender>
</ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID =" myCheckBox2" />
</Triggers>
</asp:UpdatePanel>
<asp: GridView
runat ="server"
ID="grdview"
Height="375px"
Width="1108px"
AutoGenerateColumns="False"/>
<Columns>
<asp:BoundField
DataField="instrument"
HeaderText="Type"
HeaderStyle-Width ="50px"
ItemStyle-Width ="50px"
HeaderStyle-Font-Names ="Arial"
HeaderStyle-Font-Size ="9pt">
</asp:BoundField>
<asp:HyperLinkField
Text="View"
DataNavigateUrlFields ="num"
DataNavigateUrlFormatString ="~/WebPage2.aspx?”
HeaderText =" Viewer”
HeaderStyle-Width ="115px"
ItemStyle-Width ="115px">
</asp:HyperLinkField>
</Columns>
</asp:GridView>
VB code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load, Me.Load
If Not Page.IsPostBack Then
If myCheckBox1.Checked IsNot Nothing Then
myCheckBox1.Checked = True
myCheckBox2.Checked = False
ElseIf myCheckBox2.Checked IsNot Nothing Then
myCheckBox2.Checked = True
myCheckBox1.Checked = False
End If
End Sub
Protected Sub TIF_OnCheckedChanged(sender As Object, e As System.EventArgs) Handles myCheckBox1.CheckedChanged
If myCheckBox1.Checked = True Then
TifImage()
Else
myCheckBox2.Checked = false
End if
End Sub
Protected Sub PDF_OnCheckedChanged(sender As Object, e As System.EventArgs) Handles myCheckBox2.CheckedChanged
If myCheckBox2.Checked = True Then
PDFImage()
Else
myCheckBox1.Checked = false
End if
End Sub
Hope you could help on this. I have been doing this for two days and no success. Your help is very appreciated. Thanks.