grid panel not dispalying data

  1. #1

    grid panel not dispalying data

    Hello
    I'm trying to get a gridPanel to show data selected from an SQL table, this will be a variable amount of data.

    I can retrieve the data, and I can see the data when debugging, however the Grid Panel isn't showing it.
    I have the Panel, with the relevant columns, but no data

    There is a GridView included as well, that will display the data!

    So what am I missing, done wrong with the GridPanel?

    Any pointer will be gratefully received.

    Thanks

    Chris

    Panel definition in ASPX
    1. <form id="form1" runat="server">
    2. <div></div>
    3. <div style="height:15px"></div>
    4. <div style="height:15px"></div>
    5. <div>
    6. <asp:GridView runat="server" ID="ManChecklist" AutoGenerateColumns ="False"
    7. DataKeyNames="Id" DataSourceID="CheckListDataSource"
    8. BorderColor="Black" BorderWidth="3px" AutoGenerateEditButton="True" >
    9. <Columns>
    10. <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False"
    11. ReadOnly="True" SortExpression="Id" />
    12. <asp:CheckBoxField DataField="Selected" HeaderText="Selected"
    13. SortExpression="Selected" ReadOnly="false" />
    14. <asp:BoundField DataField="Number" HeaderText="Number"
    15. SortExpression="Number" />
    16. <asp:BoundField DataField="DeviceNumber" HeaderText="DeviceNumber"
    17. SortExpression="DeviceNumber" />
    18. <asp:BoundField DataField="Platform" HeaderText="Platform"
    19. SortExpression="Platform" />
    20. </Columns>
    21. </asp:GridView>
    22. <asp:SqlDataSource ID="CheckListDataSource" runat="server"
    23. ConnectionString="<%$ ConnectionStrings:databaseConnection_ATT %>"
    24. SelectCommand="SELECT * FROM [sAttGlobalManualCheckList]">
    25. </asp:SqlDataSource>
    26. </div>
    27. <div style="height:15px"></div>
    28. <div>
    29. <ext:ResourceManager runat="server" ID="ManCheckListResource"></ext:ResourceManager>
    30. <ext:GridPanel runat="server" ID="ManCheckListPanel" AutoDataBind="true" RowLines="true"
    31. Selectable="true" SortableColumns="true" Visible="true" AutoShow="true">
    32. <Store>
    33. <ext:Store runat="server" ID="CheckListStore" DataSourceID="CheckListDataSource">
    34. <Model>
    35. <ext:Model runat="server" ID="ctl63">
    36. <Fields>
    37. <ext:ModelField Name="booleanCol" Type="Boolean"></ext:ModelField>
    38. <ext:ModelField Name="idCol" Type="Int"></ext:ModelField>
    39. <ext:ModelField Name="numberCol" Type="String"></ext:ModelField>
    40. <ext:ModelField Name="deviceNumCol" Type="String"></ext:ModelField>
    41. <ext:ModelField Name="platformCol" Type="String"></ext:ModelField>
    42. </Fields>
    43. </ext:Model>
    44. </Model>
    45. </ext:Store>
    46. </Store>
    47. <ColumnModel runat="server" ID="ManCheckColumnModel">
    48. <Columns>
    49. <ext:RowNumbererColumn runat="server" Width="25"></ext:RowNumbererColumn>
    50. <ext:CheckColumn runat="server" DataIndex="booleanCol" Text="Select" Editable="true"></ext:CheckColumn>
    51. <ext:NumberColumn runat="server" DataIndex="idCol" Text="Id"></ext:NumberColumn>
    52. <ext:Column runat="server" DataIndex="numberCol" Text="Number"></ext:Column>
    53. <ext:Column runat="server" DataIndex="deviceNumCol" Text="Device Number"></ext:Column>
    54. <ext:Column runat="server" DataIndex="platformCol" Text="Platform"></ext:Column>
    55. </Columns>
    56. </ColumnModel>
    57. <SelectionModel>
    58. <ext:RowSelectionModel runat="server" Mode="Multi"></ext:RowSelectionModel>
    59. </SelectionModel>
    60. <View>
    61. <ext:GridView runat="server" StripeRows="true" TrackOver="true"></ext:GridView>
    62. </View>
    63. <BottomBar>
    64. <ext:PagingToolbar runat="server" ID="ManCheckPagingToolbar"></ext:PagingToolbar>
    65. </BottomBar>
    66. </ext:GridPanel>
    67. </div>
    68. <div style="height:15px"></div>
    69. <div>
    70. <asp:Button runat="server" ID="ReturnToHomepage" Text="Return To HomePage"
    71. onclick="ReturnToHomepage_Click" />
    72. </div>
    73. <div style="height:15px">
    74. </div>
    75. </form>


    code behind

    1. protected void UpdateFilter_Click(object sender, EventArgs e)
    2. {
    3. UpdateFilterString();
    4. DatabaseAccessClass databaseAccess = new DatabaseAccessClass(true);
    5. if (databaseAccess.OpenJobDatabase())
    6. {
    7. SqlDataReader reader = null;
    8. SqlCommand getManCheckListCmd = new SqlCommand("spAttGetGlobalManualCheckList", databaseAccess.jobDatabaseConnection);
    9. getManCheckListCmd.CommandType = CommandType.StoredProcedure;
    10. getManCheckListCmd.Parameters.Add("@FilterConditio ns", SqlDbType.VarChar).Value = FilterString.Text.ToString();
    11. reader = getManCheckListCmd.ExecuteReader();
    12. while (reader.Read())
    13. {
    14. arrManCheckList.Add(new CManCheckList(reader));
    15. listManCheck.Add(reader.ToString());
    16. }
    17. reader.Close();
    18. }
    19. string Command = "SELECT * FROM [sAttGlobalManualCheckList] where Number Like '";
    20. Command += FilterString.Text.ToString();
    21. Command += "'";
    22. DataSourceSelectArguments Args = new DataSourceSelectArguments();
    23. CheckListDataSource.SelectCommand = Command;
    24. CheckListDataSource.Select(Args);
    25. // CheckListDataSource.DataBind();
    26. // this.CheckListStore.DataSource = listManCheck;
    27. this.CheckListStore.DataBind();
    28. this.ManCheckListPanel.DataBind();
    29. databaseAccess.CloseJobDatabase();
    30. }


    Screen shot of Grid Panel
    Click image for larger version. 

Name:	Gridpanel.jpg 
Views:	69 
Size:	77.6 KB 
ID:	4998
  2. #2
    Just compare what Name you use in ModelField and what DataField you use in BoundField
    I see that you use different names. In this case, why do you expect to see a data GridPanel?
  3. #3
    Quote Originally Posted by Vladimir View Post
    Just compare what Name you use in ModelField and what DataField you use in BoundField
    I see that you use different names. In this case, why do you expect to see a data GridPanel?
    Hi Vladimir,

    Thanks for the quick response.
    I've changed the ModelField 'Names' to match the DataFields in the BoundFields.
    Still no data displayed.

    I must be missing something fundamental here.

    Chris

Similar Threads

  1. Custom Row in Grid Panel when No Data
    By glenh in forum 1.x Help
    Replies: 0
    Last Post: May 02, 2012, 11:37 PM
  2. grid panel change data from column
    By cbu in forum 1.x Help
    Replies: 2
    Last Post: Jan 03, 2012, 11:50 AM
  3. Replies: 16
    Last Post: Feb 23, 2011, 10:03 AM
  4. Retieving Data from data base in the Grid Panel
    By Rakeshkumar.a in forum 1.x Help
    Replies: 0
    Last Post: Oct 13, 2010, 6:18 AM
  5. Get Grid Panel Row Data
    By vivekrane1986 in forum 1.x Help
    Replies: 2
    Last Post: May 31, 2010, 1:45 AM

Posting Permissions