R
Rick
Can someone help me? I have a HTMLSelect control that is populated on the
Page_Load event. I want to basically when the user makes a selection to
populate session variables upon an Item change in the HTMLSelect. I have
tried just about everything I've read and can think of, but have not been
able to get this to work.
Currently I get a script error that Hidden1 field is undefined after the
post back.
My code:
ASPX:
<script language="javascript" type="text/javascript">
function dothepostback()
{
//ddCustList gets renamed
var selval = document.getElementById("_ctl2_ddCustList").value;
Hidden1.value = selval;
//Post back the page
document.forms[0].submit();
}
</script>
<table cellpadding="0" cellspacing="0" width="100%" class="TopNavMenu">
<tr>
<td>
<CYBERAKT:ASPNETMENU id="ASPNetMenu"
clientscriptlocation="/aspnetmenu_client/" menustyle="ClassicHorizontal"
runat="server"></CYBERAKT:ASPNETMENU>
</td>
<td align="right">
<input type="text" id="Hidden1" name="Hidden1" value="" runat="server"
enableviewstate="true" />
Choose Customer:<select id="ddCustList" runat="server"
onchange="dothepostback()" enableviewstate="true"><option></option></select>
</td>
</tr>
</table>
Code Behind to get Hidden Field Value:
Dim hdnSearch As New HtmlInputText
Dim x As String
hdnSearch = FindControl("Hidden1")
x = hdnSearch.Value
Session("HIDVal") = x
I cannot use an asp DropDownList control because it requires a Form tag with
runat="server", which you cannot have multples in a web page Tthe web site
I'm working with was initially built to Inherit different parts of a page
and then put it all together at the end (Not well planned out and to change
it would be a massive undertaking). So other parts of the page may already
have the Form tag with runat="server"
Thanks in Advance!
Page_Load event. I want to basically when the user makes a selection to
populate session variables upon an Item change in the HTMLSelect. I have
tried just about everything I've read and can think of, but have not been
able to get this to work.
Currently I get a script error that Hidden1 field is undefined after the
post back.
My code:
ASPX:
<script language="javascript" type="text/javascript">
function dothepostback()
{
//ddCustList gets renamed
var selval = document.getElementById("_ctl2_ddCustList").value;
Hidden1.value = selval;
//Post back the page
document.forms[0].submit();
}
</script>
<table cellpadding="0" cellspacing="0" width="100%" class="TopNavMenu">
<tr>
<td>
<CYBERAKT:ASPNETMENU id="ASPNetMenu"
clientscriptlocation="/aspnetmenu_client/" menustyle="ClassicHorizontal"
runat="server"></CYBERAKT:ASPNETMENU>
</td>
<td align="right">
<input type="text" id="Hidden1" name="Hidden1" value="" runat="server"
enableviewstate="true" />
Choose Customer:<select id="ddCustList" runat="server"
onchange="dothepostback()" enableviewstate="true"><option></option></select>
</td>
</tr>
</table>
Code Behind to get Hidden Field Value:
Dim hdnSearch As New HtmlInputText
Dim x As String
hdnSearch = FindControl("Hidden1")
x = hdnSearch.Value
Session("HIDVal") = x
I cannot use an asp DropDownList control because it requires a Form tag with
runat="server", which you cannot have multples in a web page Tthe web site
I'm working with was initially built to Inherit different parts of a page
and then put it all together at the end (Not well planned out and to change
it would be a massive undertaking). So other parts of the page may already
have the Form tag with runat="server"
Thanks in Advance!