<div style="background-color: White; height: 600px; overflow-y: scroll;">
<asp:GridView ID="gvCategory" runat="server" AutoGenerateColumns="false"
Width="200px" Height="90%"
OnPageIndexChanging="gvSuppliers_PageIndexChanging1"
onrowdatabound="gvCategory_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Category names">
<ItemTemplate>
<asp:LinkButton ID="lbtnCategory" runat="server" CommandArgument='<%#Eval("CategoryID") %>'
OnClick="lbtnCategory_Click"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerSettings Mode="NumericFirstLast" />
</asp:GridView>
</div>
protected void lbtnCategory_Click(object sender, EventArgs e)
{
LinkButton lbtnSupplier = (LinkButton)sender;
int categoryid = int.Parse(lbtnSupplier.CommandArgument);
int intSupplierID = Convert.ToInt32(Session["intSupplierID"]);
BindProductGrid(intSupplierID, categoryid);
}
protected void gvCategory_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lbtn= (LinkButton) e.Row.FindControl("lbtnCategory");
//Text='"<%#Eval("Name")"+"("+Eval("ProductCount")%>+")"'
DataRow rowView = ((DataRowView)e.Row.DataItem).Row;
if (lbtn != null)
{
lbtn.Text = rowView["Name"] + " (" + rowView["ProductCount"] + ")";
}
}
}
No comments:
Post a Comment