This is a migrated thread and some comments may be shown as answers.

Cannot get my radgrid to bind outside of it's built in features

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 12 Aug 2010, 10:18 PM
This is driving me absolutely crazy....I am simply trying to pass in SQL parameters via textbox and date picker (with a button click) and rebind the freaking grid....I walk thru the code behind and it sets the values on the SQL params just fine, but radGridWebErrorLogs.Rebind() does absolutely nothing, the radGrid does not refresh.....code is simple and straight forward. Anyone shed some light? I am about to give up on something that should be so easy.

<telerik:RadAjaxPanel ID="radAjaxPanelSearchCriteria" runat="server">
                    <telerik:RadPanelBar runat="server" ID="radPanelBarSearchCriteria" ExpandMode="SingleExpandedItem" Width="100%">
                        <Items>
                            <telerik:RadPanelItem Expanded="True" Text="Search Criteria" runat="server" Selected="true">
                                <Items>
                                    <telerik:RadPanelItem Value="SearchCriteria" runat="server">
                                        <ItemTemplate>
                                            <div style="background-color: InactiveCaptionText">
                                                <center>
                                                <table cellpadding="4" cellspacing= "0">
                                                    <tr>
                                                        <td>
                                                            Message:&nbsp;
                                                            <telerik:RadTextBox ID="radTextBoxMessage" runat="server" Width="205px" MaxLength="250" />

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="radGridWebErrorLogs">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="radGridWebErrorLogs" />
                                <telerik:AjaxUpdatedControl ControlID="lblMessage" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:RadAjaxManager>

                <telerik:RadGrid ID="radGridWebErrorLogs" DataSourceID="dtsWebErrorLogs" ShowStatusBar="True" AllowSorting="True" PageSize="20" GridLines="None" AllowPaging="True"
                    runat="server" AllowAutomaticDeletes="True" AutoGenerateColumns="False" OnDataBound="radGridWebErrorLogs_DataBound" OnItemDeleted="radGridWebErrorLogs_ItemDeleted">
                    <MasterTableView TableLayout="Fixed" DataKeyNames="WebErrorLogID" CommandItemDisplay="None">
                        <Columns>
                            <telerik:GridBoundColumn HeaderText="Error ID" DataField="ErrorID" UniqueName="ErrorID" Visible="false" ReadOnly="true" ForceExtractValue="Always" ItemStyle-VerticalAlign="Top" />
                            <telerik:GridBoundColumn HeaderText="Application" DataField="Application" UniqueName="Application" SortExpression="Application" ItemStyle-VerticalAlign="Top" />
                            <telerik:GridBoundColumn HeaderText="Message" DataField="Message" UniqueName="Message" SortExpression="Message" ItemStyle-VerticalAlign="Top" />
                            <telerik:GridBoundColumn HeaderText="Error Source" DataField="ErrSource" UniqueName="ErrSource" SortExpression="ErrSource" ItemStyle-VerticalAlign="Top" />
                            <telerik:GridBoundColumn HeaderText="Error Path" DataField="ErrPath" UniqueName="ErrPath" SortExpression="ErrPath" ItemStyle-VerticalAlign="Top" />
                            <telerik:GridBoundColumn HeaderText="Stack Trace" DataField="StackTrace" UniqueName="StackTrace" SortExpression="StackTrace" ItemStyle-VerticalAlign="Top" />
                            <telerik:GridBoundColumn HeaderText="Date Recorded" DataField="DateRecorded" UniqueName="DateRecorded" SortExpression="DateRecorded" ItemStyle-VerticalAlign="Top" />
                            <telerik:GridButtonColumn ConfirmText="Delete this Web Error Log?" ConfirmDialogType="RadWindow" ItemStyle-VerticalAlign="Top"
                                ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                                UniqueName="DeleteColumn" HeaderStyle-Width="50px" Visible="true">
                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                            </telerik:GridButtonColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
                                                            &nbsp;&nbsp;&nbsp;Date Recorded:&nbsp;
                                                            <telerik:RadDatePicker ID="radDatePickerDateRecorded" runat="server"></telerik:RadDatePicker>
                                                            &nbsp;&nbsp;&nbsp;
                                                            <asp:Button runat="server" ID="btnSearch" OnClick="btnSearch_OnClick" Text="Search" CssClass="submitButton" />
                                                            <asp:Button runat="server" ID="btnReset" OnClick="btnReset_OnClick" Text="Reset" CssClass="submitButton" />
                                                        </td>
                                                    </tr>
                                                </table>
                                                </center>
                                            </div>
                                        </ItemTemplate>
                                    </telerik:RadPanelItem>
                                </Items>
                            </telerik:RadPanelItem>
                        </Items>
                        <CollapseAnimation Duration="100" Type="None" />
                        <ExpandAnimation Duration="100" Type="None" />
                    </telerik:RadPanelBar>
                </telerik:RadAjaxPanel>

<br />
    <asp:Label ID="lblMessage" runat="server" EnableViewState="false" />
    <br />
    <asp:SqlDataSource ID="dtsWebErrorLogs" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
        ConflictDetection="CompareAllValues"
        OldValuesParameterFormatString="original_{0}"
        SelectCommand="w_WebErrorLogs_Select" SelectCommandType="StoredProcedure" CancelSelectOnNullParameter="false" OnSelecting="dtsWebErrorLogs_Selecting"
        DeleteCommand="DELETE FROM WebErrorLogs WHERE WebErrorLogID = @original_WebErrorLogID">
        <SelectParameters>
            <asp:Parameter Name="ApplicationID" DefaultValue="<%$ AppSettings:ApplicationId %>" />
            <asp:Parameter Name="Message" Type="String" />
            <asp:Parameter Name="DateRecorded" Type="DateTime" />
        </SelectParameters>
        <DeleteParameters>
            <asp:ControlParameter ControlID="radGridWebErrorLogs" Name="original_WebErrorLogID" PropertyName="SelectedValue" />
        </DeleteParameters>
    </asp:SqlDataSource>



 protected void dtsWebErrorLogs_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            RadTextBox radTextBoxMessage = (RadTextBox)radPanelBarSearchCriteria.FindItemByValue("SearchCriteria").FindControl("radTextBoxMessage");
            RadDatePicker radDatePickerDateRecorded = (RadDatePicker)radPanelBarSearchCriteria.FindItemByValue("SearchCriteria").FindControl("radDatePickerDateRecorded");

            e.Command.Parameters[1].Value =  radTextBoxMessage.Text;
            e.Command.Parameters[2].Value =  radDatePickerDateRecorded.SelectedDate;
        }

        protected void btnSearch_OnClick(object sender, EventArgs e)
        {
            radGridWebErrorLogs.Rebind(); //THIS DOES NOTHING
        }

1 Answer, 1 is accepted

Sort by
0
Todd
Top achievements
Rank 1
answered on 13 Aug 2010, 04:07 PM
I found it.

My search button was inside a RadAjaxPanel control.

I took that out and it's working now.
Tags
Grid
Asked by
Todd
Top achievements
Rank 1
Answers by
Todd
Top achievements
Rank 1
Share this question
or