But there is an alternative, we can reference the above controls within Grid View edit mode in Pre Render method which is best i think. Open() Using da As New Sql Data Adapter(comm) dt = New Data Table("tbl") da. Open() Using da As New Sql Data Adapter(comm) dt = New Data Table("tbl") da.
In Pre Render method we can access each edit template controls so that we can easily hide or show or enable or disable those controls.
You may notice that the last column of the Grid View is a Delete column that let user delete the record from database, so I have placed Delete link button inside the tag and have specified on Click property as Java Script confirm return value, so that when user clicks on it he/she sees a confirmation box whether he/she really wants to delete the record.
Till now our Grid View is ready to be populated, now let’s write a method to populate the Grid View.
Find Control("cbo Brand"), Drop Down List) If cbo Brand Is Not Nothing Then ' You can apply condition here cbo Brand.