I added a new tab to the product edit page which shows a grid view, but the data is not showing up in the gridview. When i try storing the data from gridview in temp variables, the data is there but the gridview shows up with empty rows. It shows the exact number of rows that the result set has every time but they are blank.
I added this to the productEdit page for both Item Template and Edit Item Template.
<ajaxc:TabPanel id="tabCustomDiscount" runat="server" headertext="Custom Discount">
<ContentTemplate>
<dsc:ProductCustomDiscount id="productCustomDiscountView" runat="server" />
</ContentTemplate>
</ajaxc:TabPanel>
In the ProductCustomDiscount.ascx i have a gridview
<asp:GridView ID="discountView" AutoGenerateColumns="False"
runat="server" showrownumber="true" Width="421px" EmptyDataText="No Data"
Height="102px">
<Columns>
<asp:TemplateField HeaderText="Role">
<EditItemTemplate>
<asp:Label ID="role" runat="server"></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="role" runat="server" Width="150"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField headertext="<%$ Resources:Common,Discount %>" itemstyle-width="150px">
<EditItemTemplate>
<asp:TextBox ID="discount" runat="server"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="discount" runat="server" Width="200"></asp:TextBox>
</ItemTemplate>
<ItemStyle Width="180px"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
and in ProductCustomDiscount.ascx.cs i am filling this gridview
customDiscount cs = new customDiscount();
discountView = cs.getProductDiscounts(Utils.GetIntParameter("pid", 0), discountView);
for (int i = 0; i < discountView.Rows.Count; i++)
{
GridViewRow row = discountView.Rows[i];
temp = ((Label)row.FindControl("role")).Text;
temp2 = ((TextBox)row.FindControl("discount")).Text;
}
temp and temp2 stores the right data. But it doesn't display in the gridview. GridView always shows blank rows. I moved the gridview to some other page and it showed up fine.
So i am guessing i have to do something more in the product edit page. Not sure what. Can you please help?
Thanks
|