First of all, I am using a RadGrid control from the Q3 2009 package, Windows XP, IE...
I have a page which has a master grid which is linked to another table by datakeynames. The problem is that this child grid, which works perfectly fine, shares the same space on the web (a table cell actually) with another grid (import grid). The reason is when a user does something else on the page, this child grid hides and the other appears until the user selects a row on the master again.
What I find is that if the import grid is visible and I click the master grid, the import grid doesn't hide as the code requests, and the child grid appears, but just as a bunch of text with no datagrid look to it at all. I find though that if I click a button the postback kicks in properly and suddenly the import grid vanishes and the child table (with the same data as before) appears all nice and pretty. So, after a lot of testing and research it seems the postback just isn't doing it's job.
This is my table for the child grid and the import grid in my aspx page:
<table style="width:100%;">
<tr>
<td class="style1" width="50%" align="left" valign="top">
<telerik:RadGrid ID="rgIngredients" runat="server" DataSourceID="odsIngredients"
AllowPaging="True" GridLines="None" Skin="WebBlue" PageSize="15"
AutoGenerateColumns="False" >
<PagerStyle Mode="NextPrevNumericAndAdvanced" />
<MasterTableView DataKeyNames="trx-num" CommandItemDisplay="Top" >
<CommandItemTemplate>
<table width="100%" >
<tr >
<td style="text-align:center">
<asp:Label ID="OEHeaderType" Text="Ingredient List"
runat="server">
</asp:Label>
</td>
</tr>
</table>
</CommandItemTemplate>
<Columns>
<telerik:GridBoundColumn DataField="sequence-no" HeaderText="Seq No." SortExpression="sequence-no"
UniqueName="sequence-no">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="line-item-type" HeaderText="Type" SortExpression="Type"
UniqueName="Type">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="product-no" HeaderText="Product No" SortExpression="product-no"
UniqueName="product-no">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="product-name" HeaderText="Description" SortExpression="product-name"
UniqueName="product-name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="crop-yr" HeaderText="Crop Yr" SortExpression="crop-yr"
UniqueName="crop-yr">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="quantity" HeaderText="Quantity" SortExpression="quantity"
UniqueName="quantity">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<telerik:RadGrid ID="rgImportedItems" runat="server"
GridLines="None" ShowFooter="false"
AutoGenerateColumns="false" Skin="Sunset"
ShowHeader="true" Width="85%" >
<PagerStyle Mode="NextPrevNumericAndAdvanced" />
<MasterTableView CommandItemDisplay="Top" DataKeyNames="Type,ProductCode,Qty,CropYr,UOM,Amount,Account,PCCtr" >
<CommandItemTemplate>
<table width="100%" >
<tr >
<td style="text-align:center">
<asp:Label ID="OEHeaderType" Text="Imported File"
runat="server">
</asp:Label>
</td>
</tr>
</table>
</CommandItemTemplate>
<Columns>
<telerik:GridBoundColumn DataField="Type" HeaderText="Type">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProductCode" HeaderText="Product Code">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Qty" HeaderText="Qty">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CropYr" HeaderText="Crop Yr">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UOM" HeaderText="UOM">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Amount" HeaderText="Amount">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Account" HeaderText="Account">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PCCtr" HeaderText="PCCtr">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</td>
And this is what I've tried to do to fix this:
>this executes and nothing on the page changes until I click a button)
protected void rgCustomFormulas_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
rgIngredients.Visible =
true;
btnUpload.Text =
"Upload File";
lblUpdate.Text =
"";
btnPostback_Click(
null, null);
}
}
>I also tried the __postback javascript thing
function selectAndPostBack() {
__doPostBack(
"<%= rgCustomFormulas.UniqueID %>", "RowClicked");
}
....
protected override void RaisePostBackEvent(IPostBackEventHandler source, string eventArgument)
{
base.RaisePostBackEvent(source, eventArgument);
if (source == this.rgCustomFormulas && eventArgument.IndexOf("RowClicked") != -1)
{
rgImportedItems.Visible =
false;
rgIngredients.Visible =
true;
btnUpload.Text =
"Upload File";
lblUpdate.Text =
"";
}
}
So, I've tried a few things. I am just wondering why clicking a button (which has no code behind, just merely to trigger a postback) corrects the display, and nothing else I've tried so that it's automatic works. Any suggestions would be appreciated :(