USer Control Datagrid

Posted by Dotnetfundakumar under ASP.NET AJAX on 8/31/2009 | Views : 2318 | Status : [Member] | Replies : 2
i need more help Usercontrol Datagrid we have bind datagrid like this genrate datatable then bind datagrid client side mention field name like this datagrid how to passparameter datatable and noof fields to bind datagrid somtimes datatable return 2 columns or 3 columns field name different so how to bind and assign client side most urgent.

<
asp:DataGrid ID="Dtg1" runat ="Server" AutoGenerateColumns ="false" Width ="100%" >
<
Columns>
<
asp:TemplateColumn HeaderText ="Field1">
<
ItemTemplate>
<
asp:Label ID="lbl2" runat ="server" Text ='<%#Databinder.eval(Container,"Dataitem.Field1") %>'></asp:Label>
</
ItemTemplate>
</
asp:TemplateColumn>
<
asp:TemplateColumn HeaderText ="Field2">
<
ItemTemplate>
<
asp:Label ID="lbl3" runat ="server" Text ='<%#Databinder.eval(Container,"Dataitem.Field2") %>'></asp:Label>
</
ItemTemplate>
</
asp:TemplateColumn>
</
Columns>
</
asp:DataGrid>

Regards
Kumar



Responses

Posted by: Vuyiswamb on: 8/31/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Morning Dotnetfundakumar

I understand what you are asking, but your Subject is misleading."USer Control Datagrid "

i think you need to give us more info here. please take your time and explain everything and we will help you.

Thank you for posting at dotnetfunda


Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakhangarg on: 8/31/2009 [Member] [Moderator] Silver

Up
0
Down
Use the Item DataBound event for this. declare three column in aspx page and in databound event check if the column name return are two then hide the third column and if all the three are returned then there is no need to hide the column.

Use Template Column and then Declare litrel or label in that and at itemdatabound event find the controls and bind the alues accordingly.

Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com/


Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response