Periyannan G

Periyannan G

  • 2k
  • 45
  • 56.3k

DropDownlist Not work properly

May 24 2011 3:38 AM
Hi dear friends,

I am using One Drop Down list and bind the datas from SQL Server 2005. after that i have to select one item from Dropdown list and if i click the button(i use button also) it will redirect to another page with that drop downlist text as in a querystring.

i show my code here...

In ASPX Page:

<asp:DropDownList ID="getlist" runat="server">  </asp:DropDownList>
<br />
<asp:Button ID="but1" runat="server" BackColor="ButtonShadow"  OnClick="get_click" BorderStyle="Solid" Text="Search" Width="80px" />

In Load:

SqlCommand cmd = new SqlCommand("sp_get", connection);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
getlist.DataSource = dt;
getlist.DataTextField = "t_type";

Button Click Event:

  string text = getlist.SelectedItem.Text.ToString();

But it works upto bind data from DB.. When i click the button it fire to redirected page but not getting and querystring value. Even a data could not be stored in String "Text"..

Please say the solution for this.....

Answers (1)