469,578 Members | 1,869 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Submit button not working on a method="get" form after DataBind

Hi,

I have found a odd one, my submit button is not submitting on a
method="get" form after using any form of DataBind?

Has anyone struck this problem before?

here is snipits of the code as an example

<form id="frmUserSearch" method="get" runat="server">
<asp:DropDownList ID="listBrokers"
Runat="server"
DataSource="<%# dvBrokers%>"
DataTextField="BrokerName"
DataValueField="BrokerID" />
<input type="submit" name="search" value="search">
</form>
private void Page_Load(object sender, System.EventArgs e)
{
Brokers brokers = Methods.GetBrokers(login);
dvBrokers = new DataView(brokers.Broker, "", "BrokerName",
DataViewRowState.CurrentRows);
//listBrokers.DataBind();<- including this is the problem
listBrokers.Items.Insert(0, new ListItem("", ""));
}

Nov 19 '05 #1
2 1816
You are circumventing .NET, so it is understandable once you understand how
..NET works.

When you add a server side button to a form, .NET writes out some JavaScript
to capture the form submit and send it to the proper event handler on your
form. If you switch to GET, you are potentially interfering with this
process. If you truly desire a GET, you will have to handle more of the
coding yourself.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"ma**********@hotmail.com" wrote:
Hi,

I have found a odd one, my submit button is not submitting on a
method="get" form after using any form of DataBind?

Has anyone struck this problem before?

here is snipits of the code as an example

<form id="frmUserSearch" method="get" runat="server">
<asp:DropDownList ID="listBrokers"
Runat="server"
DataSource="<%# dvBrokers%>"
DataTextField="BrokerName"
DataValueField="BrokerID" />
<input type="submit" name="search" value="search">
</form>
private void Page_Load(object sender, System.EventArgs e)
{
Brokers brokers = Methods.GetBrokers(login);
dvBrokers = new DataView(brokers.Broker, "", "BrokerName",
DataViewRowState.CurrentRows);
//listBrokers.DataBind();<- including this is the problem
listBrokers.Items.Insert(0, new ListItem("", ""));
}

Nov 19 '05 #2
Hmm, I've into it further, and DataBind seems to be a read herring. If
i limited the numbers of brokers to around 90 it worked! It appears it
is the length of the ViewState, so you are right in a way. Using GET,
it still tries to send the ViewState in the query string an the Browser
(IE) must refuse to submit when the Querystring is just too long.
Having
enableViewState="False" in the page declaration solved this. So it is
possible if you want to be bothered working with out viewstate.

Cowboy (Gregory A. Beamer) - MVP wrote:
You are circumventing .NET, so it is understandable once you understand how .NET works.

When you add a server side button to a form, .NET writes out some JavaScript to capture the form submit and send it to the proper event handler on your form. If you switch to GET, you are potentially interfering with this process. If you truly desire a GET, you will have to handle more of the coding yourself.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"ma**********@hotmail.com" wrote:
Hi,

I have found a odd one, my submit button is not submitting on a
method="get" form after using any form of DataBind?

Has anyone struck this problem before?

here is snipits of the code as an example

<form id="frmUserSearch" method="get" runat="server">
<asp:DropDownList ID="listBrokers"
Runat="server"
DataSource="<%# dvBrokers%>"
DataTextField="BrokerName"
DataValueField="BrokerID" />
<input type="submit" name="search" value="search">
</form>
private void Page_Load(object sender, System.EventArgs e)
{
Brokers brokers = Methods.GetBrokers(login);
dvBrokers = new DataView(brokers.Broker, "", "BrokerName",
DataViewRowState.CurrentRows);
//listBrokers.DataBind();<- including this is the problem
listBrokers.Items.Insert(0, new ListItem("", ""));
}


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by lsarg | last post: by
2 posts views Thread by Tom S | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.