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

Access controls inside a RadGrid row

6 Answers 159 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sonia
Top achievements
Rank 1
Sonia asked on 05 Sep 2014, 09:54 AM
I have a RadGrid with two GridTemplateColumns and a RadDropDownList in each of them. I would like to show/hide another controls depending on the selection made in both RadDropDownLists when inserting or editing a row.
I have tried to implement OnClientSelectedIndexChanged however i do not know how to access the rest of controls of the same row to achieve that.

Any help will be welcome.  

6 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 10 Sep 2014, 10:33 AM
Hi Sonia,

You can achieve this requirement either on client-side or server-side. I'm sending a sample RadGrid web site to demonstrate a client-side implementation. Please run the attached application and let me know if your scenario is different.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sonia
Top achievements
Rank 1
answered on 22 Sep 2014, 08:34 AM
Thank you Eyup, your solution has helped me a lot.

Apart from hiding the controls, i would like to reset a RadNumericTextBox when calling hideIndefiniteSharing(editForm). This is what i have tried:

var tbNumPeriods = $telerik.findElement(editForm, "NumPeriods");
tbNumPeriods.set_value(1);

However it gives me an error "The object does not accept the property or method 'set_value'"
What am i missing?

0
Konstantin Dikov
Telerik team
answered on 24 Sep 2014, 11:56 AM
Hello Sonia,

The issue that you are facing is due to the fact that $telerik.findElement method will return a DOM element corresponding to the control's ID. In order to retrieve the client object of a control from our suite you must use $telerik.findControl method.

Information on how those two methods work can be found in the following articles:
Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sonia
Top achievements
Rank 1
answered on 24 Sep 2014, 12:02 PM
Hello Konstantin,

$telerik.findControl(editForm, "NumPeriods");

returns null,

that is why i tried with findElement.
0
Sonia
Top achievements
Rank 1
answered on 25 Sep 2014, 07:41 AM
I find out that
$telerik.findControl(editForm, "NumPeriods");

returns null when the RadNumericTextBox NumPeriods is inside table with display property = 'none'

After extracting the control above the table it returns the RadNumericTextBox control

The problem now is when i try to set visibility to false it does not work

var tbNumPeriods = $telerik.findControl(editForm, "NumPeriods");
tbNumPeriods.set_visible(false);

why?
                

 
0
Konstantin Dikov
Telerik team
answered on 29 Sep 2014, 07:43 AM
Hello Sonia,

The following simple example demonstrates that if a RadNumericTextBox is placed inside a container with display property set to "none", you will still be able to find the control with $telerik.findControl method:
<script type="text/javascript">
    function pageLoad() {
        var panel1 = document.getElementById("panel1");
        var testInput1 = $telerik.findElement(panel1, "testInput1");
        var numericTextBox = $telerik.findControl(panel1, "RadNumericTextBox1");
        debugger;
    }
</script>
 
<div id="panel1" style="display: none;">
    <input id="testInput1" type="text" />
    <telerik:RadNumericTextBox runat="server" ID="RadNumericTextBox1"></telerik:RadNumericTextBox>
</div>

However, if RadNumericTextBox is placed in a server control with Visible property set to false, it is expected to not find any nested controls, because they will not be rendered at all.

If in your scenario you do not have a server control with Visible property set to false, please provide a simplified version of your scenario that replicates the issue.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Sonia
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Sonia
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or