|
-
Sep 27th, 2010, 08:56 AM
#1
[RESOLVED] Checkbox - Postback ?
Hi All,
firstly i am not really an ASP.Net developer but i do work in C#.
Anyway one of the application that i develop has an ASP.Net section and i need to amend it.
I want to add a Checkbox which when Checked by the User will set a Session variable.
This Session variable will then be accessed on another page where it will include/disclude some SQL and therefore change the behaviour of a Search.
So i have 2 Pages - Page1 that has the Checkbox on it -
HTML
<asp:CheckBox ID="ChkShowOldVer" runat="server" AutoPostBack="true"
oncheckedchanged="ChkShowOldVer_CheckedChanged" Text="Show Old Versions" />
</a>
The Event Handler
protected void ChkShowOldVer_CheckedChanged(object sender, EventArgs e)
{
Session["ShowOldVersions"] = ChkShowOldVer.Checked.ToString();
}
And Page 2 which builds the Search criteria and displays the results in a separate Frame (not how i would have done it i hate Frames, but i dont have the option of changing it)
And what i want to do is
ShowOldVer = HttpContext.Current.Session["ShowOldVersions"].ToString();
if (ShowOldVer == "True")
{
//Build Extra SQL here !
}
Now i have 2 main problems.
1, How do i stop the whole page from executing again when doing a postback ? I only want the Changed Event to run not the whole page !
2, Why does the Checkbox not appear to Change the Checked value after postback ?
Please Mark your Thread "Resolved",  if the query is solved & Rate those who have helped you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|