This is a migrated thread and some comments may be shown as answers.

Autopopulate textbox when the dropdownlist column is selected in radgrid in place edit VB.Net

2 Answers 230 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Supriya
Top achievements
Rank 1
Supriya asked on 11 Oct 2012, 05:22 PM
Hi,

I am using a insert/delete/update radgrid, I have a dropdown list and a textbox in the rad grid, when I select a value in the dropdownlist column, then the textbox should be autopoulated with the data from the database correspoding to the value selected in the dropdownlist. (VB.Net)

For example I have menu table

itemno        |      Description
-----------------------------------
  1              |      XXX
 2               |      YYYYY

So the drop down list contains the itemno, so when the item no 2 is selected, then the Textbox should autopopulate 'YYYYY'

Any help will be highly appreciated

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Oct 2012, 05:14 AM
Hi,

You can populate the textbox in SelectedIndexChanged event of the dropdownlist as shown below.
VB:
Protected Sub ddl_SelectedIndexChanged(sender As Object, e As EventArgs)
    Dim ddl As DropDownList = DirectCast(sender, DropDownList)
    Dim item As GridEditableItem = DirectCast(ddl.NamingContainer, GridEditableItem)
    Dim txt As TextBox = DirectCast(item.FindControl("TextBox2"), TextBox)
    txt.Text = ddl.SelectedValue.ToString()
End Sub

Thanks,
Shinu.
0
Hori
Top achievements
Rank 1
answered on 26 May 2016, 05:50 AM
what in asp, i've tried to convert it into asp.net c# it doesn't happen
Tags
General Discussions
Asked by
Supriya
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Hori
Top achievements
Rank 1
Share this question
or