RadGrid - Open new window and fetch values from particular grid column

2 posts, 1 answers
  1. Anand Kesavan
    Anand Kesavan avatar
    7 posts
    Member since:
    May 2010

    Posted 12 Jul 2010 Link to this post

    Hi,
         I have grid whith 2 columns.  Couldm1 - row number and Coulmn 2 "Description"(TextBox) and button next to this description text box. When i click on this button i want to open a radwindow with single Textbox that should get value from the parent page (radgrid Description column) and disply in the radwindow Textbox , also when i change the value in Radwindow Textbox and click "Ok" button in radwindow I need want to the grid to be updated with the values entred. I tried a using javascript. But one issue is we can't send huge data using Quertystring.

    "The spec for URL length does not dictate a minimum or maximum URL length, but implementation varies by browser. On Windows: Opera supports ~4050 characters, IE 4.0+ supports exactly 2083 characters, Netscape 3 -> 4.78 support up to 8192 characters before causing errors on shut-down, and Netscape 6 supports ~2000 before causing errors on start-up"

    so Is there any other way to achive this ?

    please check my existing code for this ..


    ASPX code 

    <telerik:RadGrid ID="grd1" runat="server" AllowPaging="true" PageSize="10" AllowSorting="true"
                    AutoGenerateColumns="False" GridLines="None" Skin="WebBlue" OnItemDataBound="OnItemDataBoundgrd1" >
                  <MasterTableView >
                  <Columns>
                  
                        <telerik:GridBoundColumn
                       DataField="ID"
                       HeaderText="ID"
                       SortExpression="ID"
                       UniqueName="ID" AllowSorting="true" />
                                     
                       <telerik:GridBoundColumn
                        <telerik:GridTemplateColumn HeaderText="Comments" UniqueName="Comments">
                    <ItemTemplate><asp:TextBox ID="txtDetailDesc" runat="server" TextMode="MultiLine"  Columns="90" Text='<%# Eval("Comments") %>'></asp:TextBox>
                            <asp:Button ID="btnShowfullDescription" runat="server" Text="..." /></ItemTemplate>
                    </telerik:GridTemplateColumn>

               </Columns>
                  </MasterTableView>
                </telerik:RadGrid> 



    .CS code 

     protected void OnItemDataBoundgrd1(object sender, GridItemEventArgs e)
        { 
     string strD;
            string strDetailDesc;
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = e.Item as GridDataItem;
                intID = dataItem["ID"].Text.ToString();
                PropertyDetailDesc = dataItem["Property"].Text; 
                TextBox txtDetailDesc = e.Item.FindControl("txtDetailDesc") as TextBox;
                strDetailDesc = txtDetailDesc.Text;
                LinkButton btnOpenFullDesc = e.Item.FindControl("btnShowfullDescription") as LinkButton;
                btnOpenFullDesc.OnClientClick = "return OpenWindow('wndnew','Comments.aspx?" + "ID=" + intID + "&DetailDesc=" + strDetailDesc + "','');";
       }
    }

    Please help . my entire app need this functionality!!!!

    Thanks
    Anand Kesavan
  2. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 15 Jul 2010 Link to this post

    Hello Anand,

    Here is a set of steps in order to achieve the described functionality:
    1. For each GridDataItem in the ItemCreated handler find the Button instance inside the template column.
    2. Attach a javascript function to the onclick attribute of that anchor which opens RadWindow (passing the primary key for the currently created item as an argument to that function).
    3. Open the popup window calling window.radopen() and passing the primary key in the query string of the new window.
    4. In the content page of RadWindow retrieve the cell values from the grid source which correspond to the primary key from the query string and display them in editable textboxes.
    5. Edit the content in the textboxes, update the row in the grid source, close the popup window and refresh the grid.

    You can see that implemented in this online demo. Note that it also covers your requirement that the key value is not being edited in the edit form (RadWindow).

    If you need any assistance in integrating this approach into your project, please, let us know.



    Kind regards,
    Tsvetina
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top