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
Joma Rajab
NA
110
51.2k
how to display the value of the column in drop down list
Aug 29 2016 10:15 AM
i need to show the selected value from database in drop down list and this drop down list contains items on of them is the selected one from database
asp.net code
<asp:DropDownList ID=
"DropDownList3"
runat=
"server"
EnableViewState=
"true"
DataSourceID=
"SqlDataSource7"
AppendDataBoundItems=
"true"
DataTextField=
"Name"
DataValueField=
"SId"
Width=
"130px"
Height=
"25px"
> <asp:ListItem>Select School</asp:ListItem> </asp:DropDownList>
<asp:SqlDataSource ID=
"SqlDataSource7"
runat=
"server"
ConnectionString=
"<%$ ConnectionStrings:ConnectionString %>"
SelectCommand=
"SELECT [SId],[Name] FROM [School]"
></asp:SqlDataSource>
SqlDataReader myReader =
null
;
SqlCommand query =
new
SqlCommand(@"select * from dbo.Cousres INNER JOIN dbo.School ON
dbo.School.SId=dbo.Cousres.SId where dbo.Cousres.CourseId=
'" + TextBox7.Text + "'
", conn);
SqlDataAdapter da =
new
SqlDataAdapter();
myReader = query.ExecuteReader();
while
(myReader.Read())
{
TextBox3.Text = (myReader[
"CourseId"
].ToString());
TextBox4.Text = (myReader[
"CousreName"
].ToString());
DropDownList3.SelectedValue= (myReader[
"Name"
].ToString());
Edit.Visible =
false
;
}
please help
thnak you
Reply
Answers (
1
)
How to convert google earth KML File into Images in c# ?
My Asp.NET application Get logout just on pages who have cry