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

CardView Ajxax update

1 Answer 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 19 Feb 2009, 05:14 AM
Hello,

I just began using RadGrid and love it.  I have the basic functionality down, but what to go a bit further.  What I have now is just a basic Grid with CardView.  What I want is to have a separate dropdown that when a user selection an item it will update my Grid.  Here is my code I have now (mostly taken from the Telerik site).  Any help would help me get started. 
<!-- content start --> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" 
            Width="75px" Transparency="5"
            <img style="margin-top: 150px;" alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading4.gif") %>' /> 
        </telerik:RadAjaxLoadingPanel> 
        <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" 
            AllowPaging="True" runat="server" Skin="Forest" GridLines="None"  
    Height="1700px"
<HeaderContextMenu Skin="Vista"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</HeaderContextMenu> 
 
            <PagerStyle Mode="NextPrevAndNumeric" /> 
            <MasterTableView TableLayout="Fixed"
                <ItemTemplate> 
                    <asp:Image ID="Image1" Style="float: left;" Width="200px" Height="150px" ImageUrl='<%# "~/App_Data/inventory_images/" + Eval("picture") %>' 
                        runat="server" AlternateText="Stock Image" /> 
                    <div> 
                        <span style="font-weight: bold; font-family: Arial Black;">Price:</span> 
                        <%# Eval("price")%> 
                        <br /> 
                        <br /> 
                        <span style="font-weight: bold;">Name:</span> 
                        <%# Eval("pdname")%> 
                        <br /> 
                        <br /> 
                        <span style="font-weight: bold;">Description:</span> 
                        <%# Eval("description")%> 
                        <br /> 
                        <br /> 
                    </div> 
                </ItemTemplate> 
                <%--<GroupByExpressions> 
                    <telerik:GridGroupByExpression> 
                        <SelectFields> 
                            <telerik:GridGroupByField FieldName="Quantity" /> 
                        </SelectFields> 
                        <GroupByFields> 
                            <telerik:GridGroupByField FieldName="Quantity" /> 
                        </GroupByFields> 
                    </telerik:GridGroupByExpression> 
                </GroupByExpressions>--%> 
            </MasterTableView> 
            <ClientSettings AllowDragToGroup="true"
                <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
            </ClientSettings> 
 
<FilterMenu Skin="Vista"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
        </telerik:RadGrid> 
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"  
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"  
    SelectCommand="SELECT [pdname], [description], [picture], [price] FROM [master]"
</asp:SqlDataSource> 
        <!-- content end --> 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Feb 2009, 07:44 AM
Hello Michael,

I hope you are trying to change the items of your grid based on a RadComboBox SelectedItem. If so, you can set the Control Parameter for the SqlDataSource to which the grid and conbobox is bound as shown below:
aspx:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SI EmployeesConnectionString %>" 
               SelectCommand="SELECT [pdname], [description], [picture], [price] FROM [master]">  
                <SelectParameters> 
                    <asp:ControlParameter ControlID="RadComboBox1" DefaultValue="1" Name="pdname" PropertyName="SelectedValue" 
                        Type="String" /> 
                </SelectParameters> 
</asp:SqlDataSource>  
 
<telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="SqlDataSource1 DataTextField="pdname" DataValueField="pdname" AutoPostBack="True">           
 </telerik:RadComboBox>  

Thanks
Princy.
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or