Get value of another control client side

Thread is closed for posting
4 posts, 0 answers
  1. C9582BA4-3F66-4BD9-A36B-812031853094
    C9582BA4-3F66-4BD9-A36B-812031853094 avatar
    16 posts
    Member since:
    Jun 2006

    Posted 26 Jul 2006 Link to this post

       

    Requirements

    RadGrid version

    3.5.1 or Telerik.Web.UI 2008.1415+

    RadGomboBox version

    2.3.1 or Telerik.Web.UI 2008.1415+

    .NET version

    1.x

    Visual Studio version

    2002/2003

    programming language

    VB.NET, Javascript

    browser support

    all browsers supported by RadGrid


    PROJECT DESCRIPTION
    This demo application is inspired by Aaron Alexander and represents how to perform asynchronous request explicitly (changing the selection in RadComboBox) when checkbox is checked inside a grid row. Note that the combobox and the checkbox reside in ItemTemplate of GridTemplateColumn. To verify the state of the checkbox, we get reference to the active table row and find the input of type checkbox inside it.

    Note: The example does not perform any operation inside the RaisePostBackEvent handler but merely presents how to trigger callback request (custom logic can be added). Further information about how to raise ajax request inside webform/user control/MasterPage you can find in this documentation topic.
  2. C7498A83-7E2E-418C-8791-93EF573A7569
    C7498A83-7E2E-418C-8791-93EF573A7569 avatar
    9934 posts
    Member since:
    Nov 2016

    Posted 27 Jul 2006 Link to this post

    This is Aaron's post:

    Hi, I am looking to get the value of another control in a grid cell when an even happens in the cell (Category)

    Thanks for the assistance,
    Aaron

    <radg:GridTemplateColumn HeaderText="BlueBridge Category">
    <ItemTemplate>
    <radC:RadComboBox ID="slCategory" runat="server" AllowCustomText=false AccessKey=T MarkFirstMatch=true OnClientSelectedIndexChanged="Category" OnClientDropDownOpening ="SelectRow">
    </radC:RadComboBox>

    <br /><asp:checkbox runat=server ID="chkDefaultCategory" AutoPostBack=false /> Save Category Match
    </ItemTemplate>
    </radg:GridTemplateColumn>
    function Category(e)

    {

    Here I want to see if the checkbox in the row is checked.  if it is I will to the ajaxrequest.

    window["<%=gridMoreData.ClientID %>"].AjaxRequest("<%=gridMoreData.ClientID %>","gridMoreDataCategory");

    }

  3. A15697B7-F570-4D00-9105-ABCF01AB013E
    A15697B7-F570-4D00-9105-ABCF01AB013E avatar
    4 posts
    Member since:
    May 2010

    Posted 20 May 2010 Link to this post

    Hi Support,

    This ticket is in reference to the ticket "Support ID:311480 -- Client Side dropdown selection within radgrid".

    Thanks for the information you provided on the above ticket. I am able to achieve the desired result with that.
    My requirement is when i do a dropdownlist selection, i want to enable/disable a text box and set a value to it. i am able to do it.

    But when i try to do "Update" the values in the textbox is still the old value and not the one that i updated, whereas in the grid i see the new value that i have set.

    Below is my client side code
     

     

     

     

     

     

    function ddl1(sender, eventArgs)   
    {   
    var item = eventArgs.get_item();   
    var inputElement = item.get_comboBox().get_inputDomElement();   
    var rowElement = inputElement.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;   
     
    var inputs = rowElement.parentTextEdit.childNodes[0];   
    for (var i = 0; i < inputs.length; i++) {  
    if(inputs[i].type == "text" && inputs[i].id.indexOf("textbox1") != -1 && inputs[i].readOnly == false) {  
    if (sender._selectedIndex == 1) {  
    inputs[i].disabled = false;   
    inputs[i].value = '';   
    }  
    else if (sender._selectedIndex == 2) {  
    inputs[i].disabled = true;   
    inputs[i].value = 'N/A';   
    }  
    }  
    }  
    }  
     
     

     

     

     

     

    and here is my server side code

     

     

    protected void radgrid1_UpdateCommand(object source, GridCommandEventArgs e)   
    {  
        GridEditableItem editedItem = e.Item as GridEditableItem;     
     
        txt = editedItem.FindControl("textbox1"as TextBox;   
        if (string.IsNullOrEmpty(txt.Text)) dbl1 = null;   
        else dbl1 = Convert.ToDouble(txt.Text);  
    }  
     
     
     

    Am i missing something in the client side still? Your response is much appreciated.

    Thanks,
    Menaka.

     

     

     

     

     

     

     

     

  4. C7498A83-7E2E-418C-8791-93EF573A7569
    C7498A83-7E2E-418C-8791-93EF573A7569 avatar
    9934 posts
    Member since:
    Nov 2016

    Posted 21 May 2010 Link to this post

    Hi Menaka,

    When you change the default value of a textbox editor in RadGrid on the client with javascript and disable it, the server will not be aware of this change on subsequent postback. That is why you will need to persist this new value in asp HiddenField (for example) or other client storage in order to retrieve/pass it to the server when the form is submit. Thus you will be able to fetch the value from the disabled textbox editor inside the UpdateCommand handler and update the grid source.

    I hope this explanation is helpful. For other technical questions please continue the communication in the support thread your colleague Kaushik started. Additionally, if you are not added as a licensed developer to the purchase made by  Sharon Placzek, you can ask her to include your as a licensed developer in order to take advantage of the support options that come with this purchase.

    Best regards,

     

    Sebastian

    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.

     

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.