how to bind a Grid View in asp.net Programming
How to bind a Grid View in asp.net Programming :
We know the grid view is a more powerful and useful asp.net control.we use grid view for display data in tabular format . grid view provide many properties and methods by which we use this view for different-2 purpose.
How to make grid view by code :
<asp:GridView id="GridView1" runat="server">
</GridView>
by these tow lines code you can get Gridview in your Asp.net web page. there are many properties which is you can use for give look and feel to grid view .as like -
width,height,gridline,font,size,fount color,auto generated colons etc.
know we are try to understand how to bind Grid . for this here we take two GridView.
ok LET US STATR :
buind two Grid and
then make a new grid on the using column of these two grid in dynamically .
first Create a grid 1:
<asp:GridView ID="GridView2"
runat="server"
AutoGenerateColumns="false"
Visible="false"
onrowdatabound="GridView2_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="HeadID">
<ItemTemplate>
<asp:Label ID="lblheadID"
runat="server"
Text= '<%#Eval("HeadID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="HeadName">
<ItemTemplate>
<asp:Label ID="lblheadName"
runat="server"
Text= '<%#Eval("HeadName")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FeeType">
<ItemTemplate>
<asp:Label ID="lblFeeType"
runat="server"
Text='<%#Eval("FeeType")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount">
<ItemTemplate>
<asp:Label ID="lblAmount"
runat="server"
Text='<%#Eval("Amount")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="TotalAmount">
<ItemTemplate>
<asp:Label ID="lbltotalAmount"
runat="server"
></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Code for buinding this Grid 1 :
DataSet dshead=new DataSet();
dshead =
_objfee.Select_EstimatedAmountbyInstallmentIDfromdefineAmount(Convert.ToInt32(ddlmonth.SelectedValue), Convert.ToInt32(ddlclassId.SelectedValue));
GridView1.DataSource = dshead;
GridView1.DataBind();
Make Second Grid :
<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="false" Visible="false"
Width="301px">
<Columns>
<asp:TemplateField HeaderText="HeadID">
<ItemTemplate>
<asp:Label ID="lblHeadName"
runat="server"
Text= '<%#Eval("HeadName")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ConAmount">
<ItemTemplate>
<asp:Label ID="lblConAmount"
runat="server"
Text='<%#Eval("ConAmount")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PaidAmount">
<ItemTemplate>
<asp:Label ID="lblPaidAmount"
runat="server"
Text='<%#Eval("PaidAmount")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Code for binding second Grid:
DataSet ds1 = new DataSet();
ds1 =
_objfee.Select_EstimatedAmountbyInstallmentIDfromPaidAmount(Convert.ToInt32(ddlmonth.SelectedValue), Convert.ToInt32(ddlclassId.SelectedValue));
GridView2.DataSource = ds1;
GridView2.DataBind();
Asp.net Gridview Related Post:
- How to Bind gridview form database.
- Show gridview Row Details in Asp.net.
- Template field in gridview asp.net Example
- Introduction of Asp.net grid view Control.
- Example of Templatefield in gridview.
- Example of DropDownList inside gridView
- Asp.net grid viewControl Programming.
- Checkbox within Asp.Net gridView
- Ckeckbox list Example using javascript in gridview.
- Asp.net textbox control in inside of gridview
- Limit Number of Characters in a TextArea using jQuery
- jquery disable or Enable submit button after validation
- What is ASP.NET FRAMEWORK PART 1 Programming
- Display selected Date from data base into asp.net calendar
- How to create Line chart:,How to Make Data Table By C# code:
- Example of C# for Bind Data to asp.net Textbox inside gridview control
- Bind Data to asp.net textbox control in inside of gridview Using C# Example
- Example of Crystal report(Crystal_report_in asp.net programming )
- SQL Helper Class, Example of how to add captcha in Asp.net using C#
- Sql Query for asp.net Programming , How to create graph in asp.net:
- How to use CAPTCHA in asp.net,How to use Asp.net regular expression
Comments
Post a Comment