How to use a checkbox in a data grid? OR How can I track event in checkbox, which is one of the columns of a data grid?

 Posted by ArticlesMaint on 9/16/2009 | Category: ASP.NET Interview questions | Views: 3323

Answer: -
Note: - This is normally asked when the interviewer want to see that have you really worked practically on a project.

Following are the steps to be done:-

• In ASPX page you have to add Item template tag in data grid.

<asp:CheckBox id="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="Check_Clicked"></asp:CheckBox>

If you look at the Item template, we have “OnCheckChanged” event. This “OnCheckChanged” event has “Check Clicked” subroutine is actually in behind code. Note this method, which is in behind code, should either be “protected” or “public”
Following below is the subroutine, which defines the method

Protected Sub Check Clicked (By Val sender As Object, By Val e As EventArgs)
‘Do something
End Sub

The above steps should be defined in short to the interviewer, which will give a quick feeling of your practical experience with ASP.NET’

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response