Tuesday, August 7, 2007

how to put DropDown in DetailView or FormView

How to put dropdown (bind with another daatsource) in detailsView and Form View(wd difft source)


Source http://forums.asp.net/p/978241/1245194.aspx

Step 1
First go to adv stetting of detailView and select tht field which in place of which u wana use dropdown and select [convert to templet]

Now add sqldatasoucse in what u r getting to this (vil use ths for populating dropdown).
Let say name is SqlDataSource3 having {GroupID and NAME init}

No go to source and change followings.. thngs..
Inside

DataValueField="GroupID" SelectedValue='<%# Bind("GroupID") %>'>




DataValueField="GroupID" SelectedValue='<%# Bind("GroupID") %>'>



DataValueField="GroupID" Enabled=false SelectedValue='<%# Bind("GroupID") %>'>





Now go to

Remove previous If hav thn






In form view , u can directly go to source and remove field and add dropdown

DataValueField="GroupID" SelectedValue='<%# Bind("GroupID") %>'>


No comments: