DataGrid
-
Hi all! Is it possible to generate different types of columns in datagrid in runtime? I mean to say , I have a datagrid on my page and if I want to add a asp:templatecolumn on a fly is it possible? If so then how? Please help. Thanks in advance.
-
Hi all! Is it possible to generate different types of columns in datagrid in runtime? I mean to say , I have a datagrid on my page and if I want to add a asp:templatecolumn on a fly is it possible? If so then how? Please help. Thanks in advance.
Hi Ritwik, Yep, it's possible to add columns dynamically. See this article for more details: TopQuestionsAboutASPNETDataGridServerControl For TemplateColumns, it's a bit more complicated. See this article for adding template columns dynamically: http://www.dotnetbips.com/displayarticle.aspx?id=84 Hope that helps! Datagrid Girl http://www.datagridgirl.com http://www.codeproject.com
-
Hi all! Is it possible to generate different types of columns in datagrid in runtime? I mean to say , I have a datagrid on my page and if I want to add a asp:templatecolumn on a fly is it possible? If so then how? Please help. Thanks in advance.
Hi, You have all the different type of columns that you can include in a datagrid available to add to the datagrid dynamically.
Dim aTemplateColumn As TemplateColumn aTemplateColumn = New TemplateColumn With aTemplateColumn 'Add various templates like Item Template etc. '.ItemTemplate = '.ItemStyle = End With DataGrid1.Columns.Add(aTemplateColumn)
In a similar fashion you can even add more items like headers and footers. HTH Cheers, Venu. -
Hi Ritwik, Yep, it's possible to add columns dynamically. See this article for more details: TopQuestionsAboutASPNETDataGridServerControl For TemplateColumns, it's a bit more complicated. See this article for adding template columns dynamically: http://www.dotnetbips.com/displayarticle.aspx?id=84 Hope that helps! Datagrid Girl http://www.datagridgirl.com http://www.codeproject.com
Hi Marcie Your reply helps. Thanks for the reply. But can you help me on some thing!! The code which is there is working fine with c sharp, but when using vb.net I am not finding the proper way of writing the the following c sharp code in vb.net format. The code is for assigning event handler to the databind event of the literal control. In C sharp it is as following:- literal1.databinding+=new eventhandler(). But how can I write the same line in vb.net. Please help.
-
Hi Marcie Your reply helps. Thanks for the reply. But can you help me on some thing!! The code which is there is working fine with c sharp, but when using vb.net I am not finding the proper way of writing the the following c sharp code in vb.net format. The code is for assigning event handler to the databind event of the literal control. In C sharp it is as following:- literal1.databinding+=new eventhandler(). But how can I write the same line in vb.net. Please help.
Hi Ritwik, I'm not sure why you would need an event handler for a literal, but in VB.NET, you would use: AddHandler literal1.DataBinding, AddressOf YourEventHandlerHere Marcie http://www.codeproject.com