Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 pb building a button custom column in my datagrid

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-05-22 : 21:57:04
I m using .net 1.1 for a Windows form application. In my datagrid, I bind couple columns to related fields in my database table. But I need to add another custom column that has a checkBox and a button beside it (in the same column). The checkBox is bound to a column in my database but I need to place the button beside it as well..

The purpose for this is: In the custom column, If the checkBox is checked, the user clicks the button beside it so that a new window pops up so that the user can enter new data that will be saved for that column and that row.

I guess I need to implment a MyButtonDataGridColumn that inherits from DataGridTextBoxColumn.

1/ What method should I overide in my inherited Datagridtextboxcolumn?

2/ Do u have a little sample for my new MyButtonDataGridColumn that I need to implement?

Thanks.

twhelan1
Yak Posting Veteran

71 Posts

Posted - 2006-05-23 : 12:58:22
Why don't you just use a TemplateColumnn and put a checkbox and button control in there? Add a click event handler for the button that opens the new window and you'd be done. It sounds to me like you're over-complicating it, unless you want to create a column type that you can use in multiple datagrids.

Example:

<asp:DataGrid ...>
<TemplateColumn>
<ItemTemplate>
<asp:CheckBox ...>
</asp:CheckBox>
<asp:Button ...>
</asp:Button>
</ItemTemplate>
</TemplateColumn>
</asp:DataGrid>


~Travis
Go to Top of Page
   

- Advertisement -