<asp:DataGrid ID="dglist" runat="server" AutoGenerateColumns="false" BorderColor="#E0E0E0"
CellPadding="7" OnItemDataBound="dglist_ItemDataBound" Width="100%" AllowPaging="True" OnPageIndexChanged="dglist_PageIndexChanged" >
<pagerstyle horizontalalign="Center" mode="NumericPages" position="TopAndBottom" />
<itemstyle backcolor="WhiteSmoke" />
<Columns>
<asp:TemplateColumn><HeaderTemplate>
Candidate
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lbldte" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"name") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" Font-Bold="True"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" Width="50px"></ItemStyle>
</asp:TemplateColumn>
<asp:TemplateColumn><HeaderTemplate>
Course
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lbldte1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"course") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" Font-Bold="True"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" Width="50px"></ItemStyle>
</asp:TemplateColumn>
<asp:TemplateColumn><HeaderTemplate>
Joining date
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lbljoindate" runat="server" Width="80px" Text='<%#DataBinder.Eval(Container.DataItem,"joiningdate")%>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" Font-Bold="True"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" Width="200px"></ItemStyle>
</asp:TemplateColumn>
<asp:TemplateColumn><HeaderTemplate>
Fees
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblto" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"fees") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" Font-Bold="True"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" Width="150px"></ItemStyle>
</asp:TemplateColumn>
<asp:TemplateColumn><HeaderTemplate>
Installments
</HeaderTemplate>
<ItemTemplate>
<asp:Panel ID="pnlinstallments" Width="100%" runat="server"></asp:Panel>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" Font-Bold="True"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" Width="150px"></ItemStyle>
</asp:TemplateColumn>
<asp:TemplateColumn><HeaderTemplate>
Payment Details
</HeaderTemplate>
<ItemTemplate>
<asp:Panel ID="pnlpaymentdetails" Width="100%" runat="server"></asp:Panel>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" Font-Bold="True"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" Width="150px"></ItemStyle>
</asp:TemplateColumn>
<%--<asp:TemplateColumn><HeaderTemplate>
Timings
</HeaderTemplate>
<ItemTemplate>
From: <asp:Label ID="lblremarks" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"timingfrom") %>'></asp:Label>
To: <asp:Label ID="Label44" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"timingto") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" Font-Bold="True"></HeaderStyle>
<ItemStyle HorizontalAlign="Left" Width="200px"></ItemStyle>
</asp:TemplateColumn>--%>
<asp:TemplateColumn><ItemTemplate>
<asp:LinkButton ID="lnkedit" ForeColor="Blue" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"id") %>'
CssClass="ad_link" OnCommand="link_edit" Text="Edit"></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" Width="50px"></ItemStyle>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton ToolTip="Delete" ID="img" runat="server" OnCommand="delete_click" ImageUrl="~/SuccessPlus/Accounting/images/b_drop.png" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"id") %>'></asp:ImageButton>
</ItemTemplate>
<ItemStyle CssClass="admin_txt" HorizontalAlign="Left" Width="30px" />
</asp:TemplateColumn>
</Columns>
<headerstyle backcolor="Gainsboro" />
</asp:DataGrid>
public void bindJoblist(string job)
{
try
{
if (job == "")
{
str = "select a.id,a.cid,a.course,b.name,a.joiningdate,a.fees,a.qualification,a.timingfrom,a.timingto from TrainingDetails a inner join rip_candidate b on a.cid=b.cid";
}
else
{
str = "select a.id,a.cid,a.course,b.name,a.joiningdate,a.fees,a.qualification,a.timingfrom,a.timingto from TrainingDetails a inner join rip_candidate b on a.cid=b.cid where a.course like '"+job+"%'";
}
DataTable dt = new DataTable();
dt = db.getTable(str, cls.conStr);
if (dt.Rows.Count != 0)
{
Label1.Text = "";
dglist.Visible = true;
dglist.DataSource = dt;
dglist.DataBind();
DataGridItem dtitm;
if (dglist.Items.Count != 0)
{
for (int k = 0; k <= dglist.Items.Count - 1; k++)
{
dtitm = dglist.Items[k];
Panel pnlinstallments = (Panel)dtitm.FindControl("pnlinstallments");
Panel pnlpaymentdetails = (Panel)dtitm.FindControl("pnlpaymentdetails");
LinkButton lnkedit = (LinkButton)dtitm.FindControl("lnkedit");
str = "select a.install_id,a.date,a.amt,a.dueamt,a.paydate,a.status from InstallDetails a inner join TrainingDetails b on a.tid=b.id and a.tid='" + lnkedit.CommandArgument + "'";
DataTable dt1 = new DataTable();
dt1 = db.getTable(str, cls.conStr);
if (dt1.Rows.Count != 0)
{
Table tb = new Table();
tb.Width = 200;
Table tb1 = new Table();
tb1.Width = 450;
pnlinstallments.Controls.Clear();
pnlinstallments.GroupingText = "Installment Details";
for (int i = 0; i <= dt1.Rows.Count - 1; i++)
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
TableCell tc1 = new TableCell();
Label lbldate = new Label();
lbldate.Text = dt1.Rows[i]["date"].ToString();
Label lblamt = new Label();
lblamt.Text = ": " + dt1.Rows[i]["amt"].ToString();
tc.Controls.Add(lbldate);
tc1.Controls.Add(lblamt);
tr.Controls.Add(tc);
tr.Controls.Add(tc1);
tb.Controls.Add(tr);
}
pnlinstallments.Controls.Add(tb);
pnlpaymentdetails.Controls.Clear();
pnlpaymentdetails.GroupingText = "Due Amount Details";
for (int i = 0; i <= dt1.Rows.Count - 1; i++)
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
TableCell tc1 = new TableCell();
TableCell tc2 = new TableCell();
TableCell tc3 = new TableCell();
Label lbl = new Label();
Label lbldate = new Label();
lbldate.Text = dt1.Rows[i]["paydate"].ToString();
Label lblamt = new Label();
lblamt.Text = "Due Amount : " + dt1.Rows[i]["dueamt"].ToString();
Label lblstatus = new Label();
lblstatus.Text = "Status : " + dt1.Rows[i]["status"].ToString();
if (dt1.Rows[i]["status"].ToString() == "Extend")
{
lbl.Text = "Extend date:";
}
else if (dt1.Rows[i]["status"].ToString() == "Paid")
{
lbl.Text = "Paid date:";
}
else if (dt1.Rows[i]["status"].ToString() == "Open")
{
// lbl.Text = "Install date:";
}
tc2.Controls.Add(lbl);
tc.Controls.Add(lbldate);
tc1.Controls.Add(lblamt);
tc3.Controls.Add(lblstatus);
tr.Controls.Add(tc2);
tr.Controls.Add(tc);
tr.Controls.Add(tc1);
tr.Controls.Add(tc3);
tb1.Controls.Add(tr);
}
pnlpaymentdetails.Controls.Add(tb1);
}
}
}
}
else
{
Label1.Text = "No Data Found";
dglist.Visible = false;
}
}
catch (Exception ex)
{
}
}
No comments:
Post a Comment