TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Periyannan G
NA
45
68.1k
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;
cmd.Connection.Open();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
cmd.Connection.Close();
getlist.DataSource = dt;
getlist.DataTextField = "t_type";
getlist.DataBind();
Button Click Event:
string text = getlist.SelectedItem.Text.ToString();
Response.Redirect("searchresults.aspx?data="+text);
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.....
Reply
Answers (
1
)
Not able to import certain namespaces in c# class
Separate class for database connection