Here you go. On postback, just grab the value of the textbox and assign it to a session variable. Some of the javascript is for dealing with finding form objects when using a master file.
/*** Code Behind ***/
for (int i = 0; i < YourAccordionName.Panes.Count; i++)
{
YourAccordionName.Panes[i].HeaderContainer.Attributes.Add("onclick", "AssignIndex(" + i.ToString() + ")");
}
/*** Source View ***/
<asp:TextBox
ID="txtAccordionSelectedIndex"
runat="server"
style="background-color:#FFFFFF; color:#FFFFFF; border:solid 0px #FFFFFF"
Text="-1" />
<script language="JavaScript">
<!--
function AssignIndex(val)
{
document.forms[0].<%= txtAccordionSelectedIndex.UniqueID%>.value = val;
}
//-->
</script>
Hope that helps.
No comments:
Post a Comment