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

sqldatasource default values for radgrid

4 Answers 203 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas Derenthal
Top achievements
Rank 1
Thomas Derenthal asked on 19 Jun 2010, 02:00 AM
Sorry to start a new thread, but I searched this forum and couldn't find exactly what I'm looking for - I'm sure it's here, but there are 14,000 threads and I probably just couldn't get my query phrased right. Anyway...

I have a RadGrid that uses an SQLDataSource with a parameterized stored procedure. The params are derived from combo lists. I have default values for the parameters so that data will display when the page displays but no list items have been selected. Even though I have default values defined but the grid remains empty. 

<

 

 

asp:ControlParameter ControlID="cboState" Name="State" PropertyName="SelectedValue" Type="String" DefaultValue="WI" />

 

<

 

 

asp:ControlParameter ControlID="NamesDDL" Name="EquipmentCategory" PropertyName="SelectedValue" Type="Empty" DefaultValue="6fd56151-7b0a-43e9-beba-f55032e5a7a4" />

 

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 23 Jun 2010, 12:42 PM
Hello Thomas,

Unfortunately the provided code lines are not sufficient to pinpoint the reason for the problem. Please, open up a formal support ticket and send a runnable version of your implementation or at least send me the full code so I can inspect it and help you.

Sincerely yours,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Thomas Derenthal
Top achievements
Rank 1
answered on 23 Jun 2010, 02:23 PM
I have found a solution. Consider this issue closed. Thank you.
0
Mike
Top achievements
Rank 1
answered on 30 Nov 2010, 07:28 PM
Wondering if  you can provide me info on your solution, I am facing a similar problem, except instead of combo boxes I am using text boxes.

Any insight is appreciated.

mike
0
Thomas Derenthal
Top achievements
Rank 1
answered on 30 Nov 2010, 08:15 PM
Hope this helps.

Here is the datasource & DDL:
 <asp:SqlDataSource ID="sdsListings" runat="server" ConnectionString="<%$ ConnectionStrings:PickupTruckerConnectionString %>" SelectCommand="ListingByEquipmentCategoryAndState" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="NamesDDL" DefaultValue="6fd56151-7b0a-43e9-beba-f55032e5a7a4" Name="EquipmentCategory" PropertyName="SelectedValue" />
            <asp:ControlParameter ControlID="cboState" DefaultValue="WI" Name="State" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

Here is the DataGrid:
<telerik:RadGrid ID="ListingsGrid" runat="server" GridLines="None" Width="100%" AllowSorting="True" AllowPaging="True" Skin="Windows7" EnableViewState="False" ViewStateMode="Disabled" OnItemCreated="ListingsGrid_ItemCreated" CellPadding="2" DataSourceID="sdsListings">
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="ListingID" EnableViewState="False" ClientDataKeyNames="ListingID" DataSourceID="sdsListings" BorderStyle="None" BorderWidth="0" ItemStyle-Height="15px" AlternatingItemStyle-Height="15px" CellPadding="0" CellSpacing="0">
                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                <Columns>
                    <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" HeaderText="Info">
                        <ItemTemplate>
                            <asp:ImageButton ID="EditLink" runat="server" ImageUrl="~/Images/About.gif" ToolTip="View information about this listing" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn UniqueName="TemplateContactColumn" HeaderText="Contact" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:ImageButton ID="ContactLink" runat="server" ImageUrl="~/Images/Envelope.gif" ToolTip="Contact this contractor" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="ListingID" DataType="System.Guid" HeaderText="ListingID" ReadOnly="True" SortExpression="ListingID" UniqueName="ListingID" Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UserID" HeaderText="UserID" SortExpression="UserID" UniqueName="UserID" DataType="System.Guid" Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ShortDescription" HeaderText="Description" SortExpression="ShortDescription" UniqueName="ShortDescription">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="SourceCity" HeaderText="City" SortExpression="SourceCity" UniqueName="SourceCity">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="OperationRangeMiles" HeaderText="Range(miles)" SortExpression="OperationRangeMiles" UniqueName="OperationRangeMiles" DataType="System.Int32">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="RentalRate" HeaderText="Rate" DataFormatString="{0:C2}" SortExpression="RentalRate" UniqueName="RentalRate" DataType="System.Decimal">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="RentalPeriod" HeaderText="Period" SortExpression="RentalPeriod" UniqueName="RentalPeriod">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UserName" HeaderText="Contractor" SortExpression="UserName" UniqueName="UserName">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn UniqueName="TemplateProfileColumn" HeaderText="Profile" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:ImageButton ID="ProfileLink" runat="server" ImageUrl="~/Images/Agent.gif" ToolTip="View profile information for this contractor" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridTemplateColumn>
                    <%-- <telerik:GridTemplateColumn UniqueName="TemplateProfileColumn">
                        <ItemTemplate>
                            <asp:ImageButton ID="RatingLink" runat="server" ImageUrl="~/Images/Check mark.gif" ToolTip="View all ratings for this contractor" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>--
%>
                </Columns>
                <ItemStyle Height="15px"></ItemStyle>
                <AlternatingItemStyle Height="15px"></AlternatingItemStyle>
            </MasterTableView>
            <ClientSettings>
                <Selecting AllowRowSelect="true" />
                <ClientEvents OnRowDblClick="RowDblClick" />
            </ClientSettings>
            <PagerStyle Position="Top" />
        </telerik:RadGrid>
Tags
Grid
Asked by
Thomas Derenthal
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Thomas Derenthal
Top achievements
Rank 1
Mike
Top achievements
Rank 1
Share this question
or