This is pretty complicated, so I'll do my best to explain my issue.

I have a gridpanel with a CheckboxSelectionModel. When I select a row and click a button, I would like to take a value from the CheckboxSelectionModel and use that as a parameter in my SqlDataSource and show a gridpanel in another window with the data from the SqlDataSource. For some reason, if I hardcode in the value of the parameter for the SqlDataSource, the gridpanel shows up fine. However, as soon as I try getting the parameter value from the CheckboxSelectionModel, the gridpanel does not show up.

Here is some code that may help you better understand the problem:

Markup
<asp:SqlDataSource ID="sdsVisitHistory" runat="server" OnSelecting="sdsVisitHistory_Selecting"
     ConnectionString="<%$ ConnectionStrings:COREInfoDeskConnection %>"
     ProviderName="<%$ ConnectionStrings:COREInfoDeskConnection.ProviderName %>"
     SelectCommand="SELECT visitid, purpose, purposespecific, accommodations, accommspecific, spadmit, rhadmit,
                           TO_CHAR(checkin, 'MM/DD/YYYY') AS checkin,
                           TO_CHAR(checkout, 'MM/DD/YYYY') AS checkout
                      FROM infodesk.visit
                     WHERE visitorid = :visitorid">
    <SelectParameters>
       <asp:Parameter Name="visitorid" />
    </SelectParameters>
</asp:SqlDataSource>
	
<ext:Window ID="winVisitorHistory" runat="server" Title="Visitor History" Icon="Vcard" Width="805" Height="500"
    Modal="true" Hidden="true" Layout="Fit">
    <Items>
        <ext:FormPanel ID="fpnlVisitHistory" runat="server" Padding="3"
            ButtonAlign="Left" Width="392" AnchorVertical="100%">
            <Content>
                <ext:Label ID="txtVisitorName" runat="server" FieldLabel="Visitor" AnchorHorizontal="95%" />
                <ext:GridPanel ID="gpnlVisitHistory" runat="server" AutoDataBind="true" Frame="false"
                    StripeRows="true" TrackMouseOver="true" BodyBorder="true" AutoHeight="true" Border="true"
                    AutoScroll="true">
                    <Store>
                        <ext:Store ID="dstoreVisitHistory" runat="server" DataSourceID="sdsVisitHistory" AutoDataBind="true">
                           <Reader>
                              <ext:JsonReader IDProperty="VISITID">
                                 <Fields>
                                    <ext:RecordField Name="PURPOSE" />
                                    <ext:RecordField Name="PURPOSESPECIFIC" />
                                    <ext:RecordField Name="ACCOMMODATIONS" />
                                    <ext:RecordField Name="ACCOMMSPECIFIC" />
                                    <ext:RecordField Name="SPADMIT" />
                                    <ext:RecordField Name="RHADMIT" />
                                    <ext:RecordField Name="CHECKIN" />
                                    <ext:RecordField Name="CHECKOUT" />
                                 </Fields>
                              </ext:JsonReader>
                           </Reader>
                        </ext:Store>
                    </Store>
                    <ColumnModel ID="cmdlVisitorHistory" runat="server">
                        <Columns>
                            <ext:Column ColumnID="colPurpose" DataIndex="PURPOSE" Header="Purpose" Width="150" />
                            <ext:Column ColumnID="colPurposeSpecific" DataIndex="PURPOSESPECIFIC" Header="Purpose 2" Width="150" />
                            <ext:Column ColumnID="colAccommodations" DataIndex="ACCOMMODATIONS" Header="Accommodations" Width="150" />
                            <ext:Column ColumnID="colAccomSpecific" DataIndex="ACCOMMSPECIFIC" Header="Accommodations 2" Width="150" />
                            <ext:Column ColumnID="colSPAdmit" DataIndex="SPADMIT" Header="SC" Width="25" />
                            <ext:Column ColumnID="colRHAdmit" DataIndex="RHADMIT" Header="RH" Width="25" />
                            <ext:Column ColumnID="colCheckin" DataIndex="CHECKIN" Header="Checkin" Width="65" />
                            <ext:Column ColumnID="colCheckout" DataIndex="CHECKOUT" Header="Checkout" Width="65" />
                        </Columns>
                    </ColumnModel>
                </ext:GridPanel>
            </Content>
       </ext:FormPanel>
   </Items>
</ext:Window>
C#
protected void btnVisitHistory_Click(object sender, DirectEventArgs e)
{
    Trace.Warn("btnVisitHistory_Click");
    if (this.CheckboxSelectionModel1.SelectedRows.Count == 1)
    {
        Trace.Warn((this.CheckboxSelectionModel1.SelectedRows.Count == 1).ToString());
        this.gpnlVisitHistory.DataBind();
        winVisitorHistory.Show();
    }
    else
    {
        Trace.Warn("false");
        lblVisitors.StyleSpec = "color:red; font-weight:bold;";
        lblVisitors.Text = "Only one visitor may be selected to view Visit History.";
    }
 
    Trace.Warn(gpnlVisitHistory.Items.Count.ToString());
}
 
protected void sdsVisitHistory_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
    Trace.Warn("sdsVisitHistory_Selecting");
    string visitors = getCheckedVisitors();
 
    if (this.CheckboxSelectionModel1.SelectedRows.Count == 1)
    {
        lblVisitors.Text = String.Empty;
        sdsVisitHistory.SelectParameters.Clear();
        sdsVisitHistory.SelectParameters.Add("visitorid", visitors.TrimEnd(','));
        sdsVisitHistory.DataBind();
        Trace.Warn("visitorid", visitors.TrimEnd(','));
    }
    else
    {
        Trace.Warn("Cancel");
        e.Cancel = true;
    }
}
Using the Trace.Warn() I have verified that I am getting the correct value from the CheckboxSelectionModel, and my gpnlVisitHistory is giving the correct item count, but the gridpanel is not showing up in the window.

Here are two screen shots that show the problem I am having. The first is when I hardcode the parameter into the query in the SqlDataSource. The second is when I set the value of the parameter in the sdsVisitHistory_Selecting Event.

Click image for larger version. 

Name:	WindowWithData.png 
Views:	134 
Size:	55.7 KB 
ID:	1598

Click image for larger version. 

Name:	WindowWithoutData.png 
Views:	124 
Size:	55.0 KB 
ID:	1599

Thanks for your help, it is greatly appreciated!