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

Need explinations for Grid / Client-side Insert/Update/Delete

4 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jean
Top achievements
Rank 1
Jean asked on 22 Mar 2010, 04:52 PM
Hi guys !

I tried to use this example : http://demos.telerik.com/aspnet-ajax/grid/examples/client/insertupdatedelete/defaultcs.aspx
but I have some difficulties to make it work... :(

The principle is the same :
    - I have a radGrid with 4 ComboBox columns and 1 textBox Column
   - I have a form that I want to complete when I select a row of the radGrid

<telerik:RadGrid ID="invRadGrid" runat="server" Skin="WebBlue" Width="100%" Height="200px" 
                        OnRowDrop="invRadGrid_OnRowDrop" AllowMultiRowSelection="true" CssClass="grid">   
                        <PagerStyle  Mode="NumericPages"/>                       
                        <MasterTableView ShowHeadersWhenNoRecords="true"
                            <Columns> 
                                <telerik:GridTemplateColumn UniqueName="TemplateName" AllowFiltering="false" Reorderable="false"
                                    <ItemTemplate> 
                                        <asp:DropDownList ID="name" runat="server" width="100%" Enabled="false"/> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn UniqueName="TemplateType" AllowFiltering="false" Reorderable="false" > 
                                    <ItemTemplate> 
                                        <asp:DropDownList ID="type" runat="server" width="100%" Enabled="false"/> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn UniqueName="TemplateObligatory" AllowFiltering="false" Reorderable="false"
                                    <ItemTemplate> 
                                        <asp:DropDownList ID="obligatory" runat="server" width="100%" Enabled="false"/> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn UniqueName="TemplateUnicity" AllowFiltering="false" Reorderable="false" > 
                                    <ItemTemplate> 
                                        <asp:DropDownList ID="unicity" runat="server" width="100%" Enabled="false"/> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn UniqueName="TemplateDefault" AllowFiltering="false" Reorderable="false"
                                    <ItemTemplate> 
                                        <asp:TextBox ID="default" UniqueName="defaultTextBox" Text='<%# Eval("TemplateDefault") %>' 
                                                    runat="server" Width="100%" Enabled="false"
                                        </asp:TextBox> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                               
                            </Columns> 
                        </MasterTableView> 
                        <ClientSettings  AllowRowsDragDrop="True"
                            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" /> 
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"  /> 
                            <ClientEvents OnRowClick="rowClick"  /> 
                        </ClientSettings> 
                    </telerik:RadGrid> 

<div  style="border: 1px solid threedshadow; margin-left:10px; margin-right:10px;"
            <table width="100%" cellpadding="5px"
                <tr> 
                    <td width="15%" align="right"
                        <asp:Label ID="nameLabel" runat="server" meta:resourcekey="nameLabelResource" />                         
                    </td> 
                    <td width="55%"
                        <telerik:RadTextBox ID="nameTextBox" runat="server" Width="100%" /> 
                    </td> 
                    <td width="30%" align="right"
                        <asp:Button ID="saveChangesButton" Style="color: black; font-weight: bold;" 
                            meta:resourcekey="saveChangesButtonResource" runat="server" /> 
                        <asp:Button ID="deleteButton" Style="color: black; font-weight: bold;" 
                            meta:resourcekey="deleteButtonResource" runat="server" /> 
                    </td> 
                </tr> 
                 
                <tr> 
                    <td align="right"
                        <asp:Label ID="typeAttributesLabel" runat="server" meta:resourcekey="typeLabelResource" /> 
                    </td> 
                    <td align="left"
                        <telerik:RadComboBox ID="typeAttributesDropDownList" runat="server" width="40%"/> 
                        &nbsp;&nbsp;&nbsp; 
                        <asp:RadioButtonList ID="typeAttributesRadioButtonList" runat="server" width="48%" /> 
                    </td> 
                </tr> 
                 
                <tr> 
                    <td  align="right"
                        <asp:Label ID="defaultValueLabel" runat="server" meta:resourcekey="defaultValueLabelResource" /> 
                    </td> 
                    <td> 
                        <asp:TextBox ID="defaultValueTextBox" runat="server" width="100%"/> 
                    </td> 
                </tr> 
            </table> 

In fact I would like to know first where is definied
MyWebService.GetEmployeeByEmployeeID(employeeID, setValues) 

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Mar 2010, 01:02 PM

Hi,

You can find the WebMethod  "GetEmployeeByEmployeeID' defined in the MyWebService.cs file . Just click on the dropdown that says DefaultCS.aspx.cs and you will find the corresponding file.

Please  take a look at this and let me know your queries.

Princy
0
Jean
Top achievements
Rank 1
answered on 24 Mar 2010, 08:57 AM
gloups... I didn't see that there were several files when clicking on combo box :D

thank you for the help, I will ask you if I misunderstand something ;)
0
Jean
Top achievements
Rank 1
answered on 30 Mar 2010, 01:04 PM
Hi guys !

I would like to know if there is a way to use client side row selected without using a web service.

I simply want to use the "Client-side Insert/Update/Delete" example, that is to say when the user selects a row informations are displayed in below form, but I have some difficulties with javascript.

Thank you.

Jean
0
Jean
Top achievements
Rank 1
answered on 30 Mar 2010, 03:24 PM
I found it alone :

var name, type, obligatory, unicity, defautlValue; 
     
        function RowSelected(sender, eventArgs) { 
            var grid = sender; 
            var MasterTable = grid.get_masterTableView(); 
            var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()]; 
 
            getValues(MasterTable, row); 
 
            setValues(); 
        } 
 
        function getValues(masterTable, r) { 
            debugger; 
            name = trim(masterTable.getCellByColumnUniqueName(r, "name").innerHTML); 
            type = trim(masterTable.getCellByColumnUniqueName(r, "type").innerHTML); 
            obligatory = trim(masterTable.getCellByColumnUniqueName(r, "obligatory").innerHTML); 
            unicity = trim(masterTable.getCellByColumnUniqueName(r, "unicity").innerHTML); 
            defaultValue = trim(masterTable.getCellByColumnUniqueName(r, "default").innerHTML); 
        } 
 
        function setValues() { 
            $find("<%= nameTextBox.ClientID %>").set_value(name); 
            $find("<%= defaultValueTextBox.ClientID %>").set_value(defaultValue); 
        } 

But now I am a bit lost with my asp radioButtonList. Indeed, values of above variables (type, obligatory and unicity) decide of corresponding asp radioButtonList.

For example, if type=="Yes", typeRadioButtonList selected index will be 0. On the contrary 1.

An idea how to do ?

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