Client Side how to find the cellIndex in focus of Radnumerictextbox or Radcombobox Template controls

3 posts, 0 answers
  1. Pabanas
    Pabanas  avatar
    14 posts
    Member since:
    Nov 2008

    Posted 24 May 2009 Link to this post


    I have a Radgrid with Radcombobox , radnumericbox and radtextbox  all have the same onfocus and onblur event assigned to it . I want to get the cellindex on the focus event  and  on eaech cellindex I want to do different processing ?

              if i click a column I can get it as below and display it in a textbox .

    function ColumnClick(sender, eventArgs) {
            var text = "";
            text = eventArgs.get_gridColumn().get_element().cellIndex;
            document.getElementById("TextBox2").value = text;
        }

              I want the same for radnumeric control in template in the focus event .

    Please kindly help us .

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 May 2009 Link to this post

    Hello Pabanas,

    You can try out the following code to get the cell index on setting focus on a RadNumericTextbox in the ItemTemplate of a GridTemplateColumn:
    aspx:
     <telerik:GridTemplateColumn UniqueName="TemplateCol">       
            <ItemTemplate> 
                <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server"
                </telerik:RadNumericTextBox>           
            </ItemTemplate>      
     </telerik:GridTemplateColumn> 

    c#:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridDataItem) 
            { 
                GridDataItem dataItem = (GridDataItem)e.Item; 
                foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) 
                { 
                    if (col.UniqueName == "TemplateCol"
                    { 
                        RadNumericTextBox rdntxt = (RadNumericTextBox)dataItem[col.UniqueName].FindControl("RadNumericTextBox1"); 
                        rdntxt.Attributes.Add("onfocus""return GetcellIndex(" + col.OrderIndex + ");"); 
                    } 
                } 
            } 
         } 

    js:
    <script type="text/javascript"
    function GetcellIndex(cellIndex) 
      alert(cellIndex); 
    </script> 
    You can try the same logic for other controls.

    Thanks
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 26 Jul 2011 Link to this post

    Hi guys,

    Please, how can I setfocus on the next control index or in specific column name?

    Thanks, best

    Daniel
Back to Top