how we can fire event in databound column in datagrid without using button?



how we can fire event in databound column in datagrid without using button?..

Answer / Ankur Gupta

You can achieve this by using a TemplateField in your GridView and setting the AutoPostBack property of the control you want to respond to events (like CheckBox, DropDownList, etc.) to true. Here's an example:

```csharp
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="My Column">
<ItemTemplate>
<asp:CheckBox ID="chkColumn" runat="server" AutoPostBack="True" OnCheckedChanged="chkColumn_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
```
In the above example, a CheckBox is used inside a TemplateField to respond to events without using a Button.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net AllOther Interview Questions

What is password attribute of the textbox control of .net mobile? : Microsoft dot net mobile

1 Answers  


Explain how does .net mobile work? : Microsoft dot net mobile

1 Answers  


HI THIS IS THIRUMAL. I AM COMPLETED MY MCA IN 2009 WITH 64%. NOW I AM LOOKING FOR A JOB(FRESHER)IN HYDERABAD.PLEASE IF YOU FIND ANY OPENINGS IN ANY COMPANY SEND IT TO MY MAIL ID PLEASE.. SKILL SET : C,C++,C#.NET,ASP.NET,ADO.NET,SQL SERVER, SSIS,SSRS EMAIL ID : THIRU104@GMAIL.COM THANKS & REGARDS D.THIRUMAL

1 Answers  


What is CLR,MSIL and Jit Compiler and their roll in .net

1 Answers   PCS,


which would be the best to use inproc,outproc or sql server

2 Answers   Ness Technologies,


what is tracing? Where it used?

1 Answers  


What does the term "green architecture" mean? : Dot net architecture

1 Answers  


What is .net transaction?

1 Answers  


What is the mesi? : .NET Architecture

1 Answers  


how to make and display a form without title bar?

1 Answers   Six Sigma,


what is class and object explain with example?

8 Answers   Six Sigma,


inprocess vs out process session state : Dot net architecture

1 Answers  


Categories