How to create static Column for Grid View control in asp.net
Step 2 : Open that page and Drag and Drop GridView control from Toolbox Diaglog box
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
Step 3 : First set the property AutoGenerateColumns="False" that will not allow to bind non- static column to bind data.
Step 4 :Right click on Grid View Control select Edit Column option one popup will open you can add any custom control and modify there property . view below code
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" >
<Columns>
<asp:BoundField DataField="RollNo" HeaderText="Roll No" />
<asp:BoundField DataField="StudentName" HeaderText="Studnet Name" />
<asp:BoundField DataField="MobileNo" HeaderText="Mobile No" />
<asp:BoundField DataField="Address" HeaderText="Address" />
</Columns>
</asp:GridView>
Step 4 :This way you can add custom column to grid view
Step 5 : Just run your application and see see the grid view
No comments:
Post a Comment
Thank you for your interest .