Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid Change text to dropdown for single row?

Status
Not open for further replies.

vituja123

Programmer
Jun 16, 2005
110
US
Me Again,

Since I could get this to work (
Is it possible to change the Textbox control to a dropdownlist for a single row inside a datagrid?

If e.Item.DataItem("Field_ID") = 6 Then
Dim DLIST As New DropDownList
DLIST.ID = "DList1"
DLIST.Items.Add("0")
DLIST.Items.Add("25")
DLIST.Items.Add("50")
DLIST.Items.Add("75")
e.Item.Cells(1).Controls(0)= DLIST
end if
 
Fisrst, where are you placing this code, what event? I assume it is the ItemDataBound event of the grid.
 
Yes, it is in the item bound event. I don't want to add the control (since it loses its value after postback),

Instead I just want to change its type from textbox to dropdown.

Dim DLIST As New DropDownList

DLIST.ID = "DList1"
DLIST.Items.Add("0")
DLIST.Items.Add("25")
DLIST.Items.Add("50")
DLIST.Items.Add("75")
e.Item.Cells(1).Controls.Add(DLIST)
******************* instead of .ADD how can I change/modify the current textbox???
 
I don't see any way of doing that. The best idea I could come up with is to add the type of control to the DG that you want based on some condition. But I think that may cause you problems based on your last thread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top