Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Accessing a control in templated column client side?
posted

Hello,

For some reason I am having trouble with this:  how do I access a control in a templated column through client script?  I can reference the row and the cell that I need, but I can’t set the value of the control (asp:dropdownlist) in the cell.  This is being done from the onclick event of a control outside the grid.

What is the syntax for accessing a control in the cell template? 

The function looks like this so far: 

function FieldSvcClick(source) {

  var item = source.value; //the value of the selected item

  var grid = igtbl_getGridById(GridID);

  if (item == "NotFieldServices") {

       for (i = 0; i < grid.Rows.length; i++) {  //loop through the rows to find the right one

            var row1 = grid.Rows.getRow(i);

            var name = row1.getCell(1).getElement().children[0].innerText; //get the name value in column(1)

            if (name == "Field Services") {

                   row1.getCellFromKey("Required").setValue(1); //this works but is not what I want to do

                   //set the value of the dropdown here

                   return;

}}}}

The templated column looks like this:

<igtbl:TemplatedColumn AllowUpdate="Yes" BaseColumnName="Required" Key="Required" Width="75px">

<CellTemplate>

<asp:DropDownList ID="ddlRequired" runat="server">

<asp:ListItem Value="1">Yes</asp:ListItem>

<asp:ListItem Value="0">No</asp:ListItem>

</asp:DropDownList>

<asp:Label ID="lblRequired" runat="server"></asp:Label>

</CellTemplate>

</igtbl:TemplatedColumn>

Parents Reply Children