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
Chevy Mark Sunderland
NA
188
166.8k
DropDowList problem
Aug 10 2012 5:40 AM
Hi there, I need your help.
Here is my problem.
I have this
DropDownList
populate with this query in dbms SQL Server 2008:
sql2 = "SELECT * FROM dbo_40 " +
" ORDER BY " +
" Sort;";
dadapter = new SqlDataAdapter(sql2, ConnSqlServer);
dset = new DataSet();
dadapter.Fill(dset);
DropDownList3.DataSource = dset.Tables[0];
DropDownList3.DataTextField = "MAT";
DropDownList3.DataValueField = "Sort";
DropDownList3.DataBind();
In this
DDL
I need add the
ALL
value and tried this code:
<asp:DropDownList ID="DropDownList3" runat="server" AppendDataBoundItems="True" AutoPostBack="True"
Font-Size="10pt" OnSelectedIndexChanged="DropDownList3_SelectedIndexChanged">
<asp:ListItem Value="%">---</asp:ListItem>
<asp:ListItem Value="5">ALL</asp:ListItem>
</asp:DropDownList>
public void GridViewBind()
{
sql1 = "SELECT TOP 1000 * FROM dbo_40;";
if (DropDownList3.SelectedIndex == 5)
{
sql1 = "SELECT * FROM dbo_40 WHERE sID = 5;";
Response.Write(DropDownList3.SelectedIndex);
}
}
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewBind();
}
But in the
code-behind
the value
DropDownList3.SelectedIndex
for
ALL
it's null or empty.
Can you help me?
Thanks in advance.
Reply
Answers (
2
)
Asp.Net Mvc Design Pattern
Unable to Close Popup window using ASP.Net