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

Check validate value in FormTemplate radgrid when open both edit and insert?

2 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vvt
Top achievements
Rank 1
Vvt asked on 07 Sep 2012, 08:28 AM
I open both edit and insert form. When I click update button(in insert form). I need to test validate any value  of controls by javascript.
How I find control in insert form only without in edit form?
if i use below function . It get 2 controls that have the same ID in Edit and Insert Form.  

 

function GetGridServerElement(radGridID, serverID, ControlType) { 

    var grid = document.getElementById(radGridID); 

    var elements = grid.getElementsByTagName("*"); 

    for (var i = 0; i < elements.length; i++) { 

        var element = elements[i]; 

        if (element.id.indexof(serverID)>0) { 

            if (ControlType == "rad") { 

                return $find(element.id);

            }

            else

                return element; 

                    }

            }

    }

}

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 07 Sep 2012, 08:54 AM
Hello,

function AcceessOtherControl(obj) {
                var SenderId = obj.id;
                
                var TextBox1 = $("#" + SenderId.replace("btn1", "TextBox1")).get(0);
 
                var btn1 = $("#" + SenderId).get(0);
 
                // Access your control here
            }
<EditFormSettings EditFormType="Template">
                   <FormTemplate>
                       <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                       <asp:Button ID="btn1" Text="commandName" runat="server" OnClientClick="AcceessOtherControl(this);" />
                   </FormTemplate>
               </EditFormSettings>
           </MasterTableView>


Thanks,
Jayesh Goyani
0
Vvt
Top achievements
Rank 1
answered on 08 Sep 2012, 08:44 AM
Thanks  Jayesh Goyani.
Tags
Grid
Asked by
Vvt
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Vvt
Top achievements
Rank 1
Share this question
or