Making DropDownlist Selected Automatically on giving value

s if there eexists one Drop downlist

and  if it have values from dataset say Ds

and that dataset ds is having a table named Ab with 2 columns a)TextData  b) ValueData

so we will set our data set like this

Ds.Tables(0)

so we will set dropdownlist as

DropDownList.DataSource() = Ds1.Tables(0)
DropDownList.DataValueField = "ValueData";
DropDownList.DataTextField = "TextData";
DropDownList.DataBind();

 

so now Drop down list have TExt and value

so i have to select and show TextData dropdownlist automatically on passing its Textvalue

we can do it using

 clipboard | view source | convert again

string i = Ds.Tables(0).Rows(0)("ValueData").ToString();
DropDownList.Items.FindByValue(i).Selected = true
This is the method of selecting datagrid using its value at runtime
Advertisements

About kakani santosh kumar

Working as Software Engineer in Prithvi Information Solutions having 3 years of Experience in Dotnet Framework ranging from 1.1 to 3.5
This entry was posted in Articles, Interview Questions, Programming and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s