Hello friends,

I have a gridview which has 4 columns.

In the first column i have Name.
In the second i have School Name ( This is a Drop down list which is Disabled on Page Load)
In the third i have Template filed wherein i have put an Button named Edit.
In the fourth i have Grades.

What i want is when the user clicks on the Edit button only that Row's ddl should be enabled and the user can make necessary changes...

How to achieve this??? Please help me out...


cya
Rohan

Recommended Answers

All 6 Replies

Hi,

Just call this procedure in your Gridview 's rowediting event...

Private Sub _enable()
        Dim ddl As DropDownList

       ddl = ctype(GridView1.Rows(GridView1.EditIndex).FindControl("Dropdownlist1"), DropDownList)
        If Not IsNothing(ddl) Then
            ddl.Enabled = True
        End If
    End Sub

Dont forget to mark as solved if it helps you!!!!

commented: Thanks, Solved. +0

i want the DDL to be enabled on the click of the Edit button.... How to achieve this??

Convert the field to Template field. In the EditItemTemplate, you place the drop down. Provide the DataKeyNames property in the Grid property.
Set the DataTextField and DataValueField property of Dropdown
Hope this will do it.

hello ,

Can anyone please help me out with my above mentioned problem. Is there any way i can achieve it? It appears to be simple however it is not working for me.
Is there any javascript function that can be helpful?

hi laghaterohan

Post your code, we will help you!!!

Hii Yousuf,

I have got it working....I have used a Naming Container property which made things pretty simple..

Thanks a lot for help!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.