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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid

Status
Not open for further replies.

vituja123

Programmer
Jun 16, 2005
110
US
Hi All,

I have a question about pairing inserting new controls during runtime to a bounded datagrid. I have a table that holds Value/pairs:
fieldID, Value
1 , "TimeSpent"
2 , "price"
....

Another tables holds
FieldID,UserData
1 ,"1.25"
2 ,"100"
What I want to do is split up the Timespent into two controls, A text control for the hour and a dropdown box for the minutes.

So in the itembound sub if I come across fieldID 1, I want to show a text box for the hour and a dropdownlist for minutes(based on 15 minute increments).

My question is how do I insert the new dropdown list control. The list should already contain 0,25,50,75

I've tried this but it doesn't work:
If e.Item.DataItem("Field_ID") = 4 Then

X = InStr(e.Item.DataItem("ValueData"), ".")
If X > 0 Then
HRS = Mid(e.Item.DataItem("ValueData"), 1, X - 1)
MIN = Mid(e.Item.DataItem("ValueData"), X + 1)
Else
HRS = e.Item.DataItem("ValueData")
MIN = 0
End If
'Load the dlist with default values
DLIST.Items.Add(0)
DLIST.Items.Add(25)
DLIST.Items.Add(50)
DLIST.Items.Add(75)

e.Item.Cells(1).Text = HRS
e.Item.Cells(1).Controls.Add(DLIST)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top