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

Find Dropdown Control in GridTemplateColumn and change index (ClientSide)

1 Answer 209 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Laz
Top achievements
Rank 1
Laz asked on 15 Jun 2009, 09:34 AM

Hi,
i want to change the Index for every Dropdown - List in a GridTemplateColumn. Everything Clientside.

My Problem is to find the Dropdownlist:

        function ColumnDecisionExecute() {  
            var DataItems = $find("<%=rdgWI.ClientID %>").get_masterTableView().get_dataItems();  
            for (i = 0; i < DataItems.length; i++) {  
                var item = DataItems[i].FindControl("ddlDecision");  
                alert(item);  
            }  
        }  
 

Here the RadGrid:

            <telerik:RadGrid ID="rdgWI" 
                             runat="server"   
                             AutoGenerateColumns="False" 
                             GridLines="None"   
                             AllowPaging="False"               
                             AllowSorting="true">  
                <HeaderContextMenu> 
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                </HeaderContextMenu> 
 
                <ClientSettings> 
                    <Scrolling AllowScroll="True" UseStaticHeaders="true" /> 
                    <ClientEvents OnGridCreated="GetGridObject"></ClientEvents> 
                </ClientSettings> 
 
                <MasterTableView ShowHeadersWhenNoRecords="true" AllowSorting="True" ShowHeader="true" runat="server">  
                     
                    <RowIndicatorColumn> 
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn> 
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </ExpandCollapseColumn> 
                    <Columns> 
                        <telerik:GridBoundColumn  DataField="WI" UniqueName="WiId" Visible="false">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridTemplateColumn HeaderText="Decision" SortExpression="" UniqueName="Decision" Visible="false">  
                            <ItemTemplate> 
                                <asp:DropDownList ID="ddlDecision" DataSource='<%# GetDataSource(Eval("WTask")) %>' DataValueField="Description" DataTextField="Shorttext" runat="server" CssClass="DT" Width='<%# GetWidth() %>'></asp:DropDownList> 
                             </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        </Columns> 
                </MasterTableView> 
                <FilterMenu> 
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                </FilterMenu> 
            </telerik:RadGrid> 
 

THX for your help!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Jun 2009, 10:21 AM
Hello Laz,

Checkout the following code library which demonstrates how to get a reference to the DOM element of a server-side control (placed in GridTemplateColumn) on the client using a global registry that keeps control ID's.
Accessing server controls in a grid template on the client

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