So I have 2 pages. They both have the same master page and are part of the same Web Application. I am trying to submit one page to the other. On the submitting page I have a few elements such as
<ajaxToolkit:ComboBox ID="cmboOptions" AutoCompleteMode="SuggestAppend"
CaseSensitive="false" ItemInsertLocation="Append" runat="server" DropDownStyle="DropDownList">
<asp:ListItem></asp:ListItem>
<asp:ListItem Text="Option 1" Value="opt1"></asp:ListItem>
<asp:ListItem Text="Option 2" Value="opt2"></asp:ListItem>
</ajaxToolkit:ComboBox>
I am using
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
PostBackUrl="~/Results.aspx" />
to submit the page.
On the results page in the code behind on page load I have
NameValueCollection nvc = Request.Form;
string selectedOption = nvc["cmboOptions"];
If I look in the NVC on debug I can see
ctl00$MainContent$cmboOptions$TextBox
with a value of "Option 1" yet my string still contains a value of null. I do not want to even bother trying to get the value by hard coding the obfuscated ID's in and I can't set a name property on ASP.net elements.
Does anyone know a better/proper way to accomplish what I am doing? I would like to stick with the ajaxControlToolkit comboboxes because they are nice for the user although I wish I stuck with jQuery instead of listening to my friend and now it's too late to switch.
I looked here without any luck
and here
Read Post Data submitted to ASP.Net Form
and here
http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
and I tried PreviousPage.FindControl and I always get null.
Thanks for your time!
Edit:
Avoid the AjaxControlToolKit. It is nice if you want to be lazy and drag->drop sweet UI elements but is just a headache to get simple things working! Use jQuery.