i Want Grid Custom Editable Item Validation In Client Side Using JavaScript

2 posts, 0 answers
  1. Ravi
    Ravi avatar
    13 posts
    Member since:
    Oct 2008

    Posted 20 Dec 2008 Link to this post

    hello,
              i Have a two textbox and one rad combobox in Radgrid Editable item.....when i add new record first i select my combobox value
    and generate new textbox runtime using javascript  ....
    like this function


     function HandleEndChanging(sender, args)
        {

          sTable = "<table cellpadding=0 cellspacing=0  border=0 width=100%><tr><td>"
            if(sender.get_value()==sender.get_value())
            {
                sTable +="<div id=divremove"+ sender.get_value() + "><table cellpadding=0 cellspacing=0  border=0 width=100%>"
                sTable += "<tr><td align=center colspan =2><input type=hidden id=hidmetalist" + sender.get_value() + " value=" + sender.get_text()+ "></td></tr>"
                sTable += "<tr><td align=right valign=top width=40%>" + sender.get_text() + "&nbsp;:&nbsp;" + "</td><td align=left width=60%><textarea id=txtarea" + sender.get_value() + " style=width:270px ></textarea>&nbsp;&nbsp;<a id=removelink" +  sender.get_value() + " style=cursor:pointer;text-decoration:underline; onclick=fn_remove('"+ sender.get_value()+ "')>Remove</a></td></tr>"
                sTable +="</table></div>"
            }
            sTable += "</td></tr></table>"
            document.getElementById("DivIncrement").innerHTML += sTable

     }

    (its working fine)

    and i insert records using ajax function in the ( runtime genration textbox.).....

    (its also working fine)


    but some problem is there for validate default text boxes....

    First i used requirefied validator.....it working but when i click update button runtime creation textboxes hide automatically ....



    <EditFormSettings  EditFormType="Template"  >
                                                <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                                                <FormCaptionStyle CssClass="RadGridHeader"></FormCaptionStyle>
                                                <FormMainTableStyle BackColor="White" GridLines="Horizontal" CellPadding="3" Width="100%" CellSpacing="0"></FormMainTableStyle>
                                                <FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px" BackColor="White" />
                                                <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                                                <EditColumn CancelText="Cancel edit" InsertText="Insert Order"  UniqueName="EditCommandColumn1" ButtonType="ImageButton" UpdateText="Update record">
                                                </EditColumn>
                                                <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                                                    <FormTemplate >
                                                        <table cellpadding="0"  cellspacing="0" width="100%" border="0">
                                                            <tr><td style="height:3px;" colspan ="2"></td></tr>
                                                            <tr>
                                                                <td align="right" colspan="2">
                                                                   <asp:ImageButton ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' ImageUrl="~/Images/icons/Update.gif"
                                                                    runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' OnClientClick="return fn_metaupdatechild()">
                                                                    </asp:ImageButton>&nbsp;
                                                                    <asp:ImageButton ID="Button1" Text="Cancel" runat="server" CausesValidation="False" ImageUrl="~/Images/icons/CancelEdit.gif"
                                                                    CommandName="Cancel" OnClientClick="DeleteHiddenvalue()"></asp:ImageButton>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td width="53%">
                                                                    <div id="Divadd"  runat="server">
                                                                        <table cellpadding ="0" cellspacing ="0" border ="0" align ="center" width ="100%" >
                                                                            <tr>
                                                                                <td width="30%" align="right">Name <font color="red" >*</font>:&nbsp;</td>
                                                                                <td align="left">
                                                                                    <input type="hidden" id="hiddGetreffid" runat ="server" value='<%#Eval("metatagrefid") %>' />
                                                                                    <asp:TextBox ID="txtName" runat="server" EnableTheming ="true" Text='<%#Eval("name") %>' ></asp:TextBox>&nbsp;
                                                                                    <asp:RequiredFieldValidator ID="ReqName" CssClass="errormsg" runat="server" ControlToValidate="txtName" Display="Dynamic" ErrorMessage="Enter Name"></asp:RequiredFieldValidator>
                                                                                </td>
                                                                            </tr>
                                                                            <tr><td colspan ="2" height="4px"></td></tr>
                                                                            <tr>
                                                                                <td width="30%" align="right" valign="top">Description <font color="red" >*</font>:&nbsp;</td>
                                                                                <td align="left" valign="top" width="70%">
                                                                                    <asp:TextBox ID="txtDesciption" runat="server" EnableTheming ="true" Text='<%#Eval("description") %>' TextMode ="MultiLine" style="height:60px;width:200px;" ></asp:TextBox>&nbsp;
                                                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" CssClass="errormsg" runat="server" ControlToValidate="txtDesciption" Display="Dynamic" ErrorMessage="Enter Desciption"></asp:RequiredFieldValidator>
                                                                                </td>
                                                                            </tr>
                                                                            <tr><td colspan ="2" align="center">&nbsp;</td></tr>
                                                                            <tr>
                                                                                <td colspan="2" align="center" width="100%">
                                                                                    <div id="divmulticombo">
                                                                                        <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
                                                                                            <tr>
                                                                                                <td align="right" width="30%">New Metatag List <font color="red" >*</font>:&nbsp;</td>
                                                                                                <td align="left" width="70%">
                                                                                                    <telerik:RadComboBox ID="RdcmpMetalist" runat="server" Width="200px" Height="220px"   MarkFirstMatch="True"  EnableVirtualScrolling="True"  OnClientSelectedIndexChanged="HandleEndChanging">
                                                                                                        <CollapseAnimation Duration="200" Type="OutQuint" />
                                                                                                    </telerik:RadComboBox>&nbsp;
                                                                                                    <asp:RequiredFieldValidator ID="ReqMetaList" CssClass="errormsg" runat="server" ControlToValidate="RdcmpMetalist" Display="Dynamic" ErrorMessage="Select Metatag List"></asp:RequiredFieldValidator>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                            <tr><td colspan ="2" align="center">&nbsp;</td></tr>
                                                                        </table>
                                                                    </div>
                                                                </td>
                                                                <td width="47%" valign="top" align="left">
                                                                    <div align="left" style="overflow:auto; height:150px; width:100%;">
                                                                         <table cellpadding ="0" cellspacing ="0">
                                                                                <tr>
                                                                                    <td colspan="2" width="100%" align="left">
                                                                                        <div id="DivIncrement" align="left"></div>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td colspan="2" width="100%" align="left">
                                                                                        <div id="DivEditRecordDisplay" align="left"></div>
                                                                                    </td>
                                                                                </tr>
                                                                          </table>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                            <tr><td colspan="2" height="2px">&nbsp;</td></tr>                                           
                                                            <tr><td style="height:15px;" align="center" style ="padding-right:60px" colspan="2"><asp:label runat="server" ID="lblEditFormMsg"  CssClass="errormsg"></asp:label></td></tr>
                                                        </table>
                                                    </FormTemplate>
                                                </EditFormSettings>




    -----------------------------
    *************      So i want all Editable items id to validate Client side .....
    **************  how to get all editable items id...................


    i get some id in internetExplorer (RadGrid1$ctl00$ctl02$ctl03$txtName) like this for this textbox( <asp:TextBox ID="txtName" runat="server" EnableTheming ="true" Text='<%#Eval("name") %>' ></asp:TextBox>)


    (RadGrid1$ctl00$ctl02$ctl03$txtName) its working clientside validation in internet Explorer using javasript but ... Still it not Working Firefox......

    its too urgend......Reply me immediately....

    Thank you For your Advance Help.....






    its my full coding



    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="ManageMetaTags.aspx.vb" EnableEventValidation="false"  Inherits="Clients_ManageMetaTags" Debug ="true"  %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <%--<script src="../Library.js" language="javascript" type="text/javascript"></script> --%>
    <script language="javascript" type="text/javascript">
        function IsGridItemsSelected(Action)
        {
            if($find("<%= RadGrid1.MasterTableView.ClientID  %>").get_selectedItems().length <= 0)
            { 
                alert("Select MetaTag(s) to " + Action); 
                return false;
            }
            else
            {
                var MasterTable = $find("<%=RadGrid1.MasterTableView.ClientID %>");
                var Getmetaid = document.getElementById("hiddMetatagdeleteid");
                Getmetaid.value = ""
                var selectedRows = MasterTable.get_selectedItems();
                for (var i = 0; i < selectedRows.length; i++)
                {
                    var newGetmetaid = MasterTable.getCellByColumnUniqueName(selectedRows[i], "metatagrefid")
                    Getmetaid.value += "," + newGetmetaid.innerHTML;
                }
                if(Getmetaid.value != "")Getmetaid.value = Getmetaid.value.substring(1);
                return true;
            }
        }
        function HandleEndChanging(sender, args)
        {   
            var item = args.get_item();
            //alert(sender.get_text())
            //  alert(sender.get_value())
           
            if(sender.get_value()==0)
                {
                    return false;
                }
            if(document.getElementById("hiddgetEditdropval").value != "")
            {
                var newchildEditval=document.getElementById("hiddgetEditdropval").value
                var GetSplitchildEditVal = newchildEditval.split(",")
                for(j = 0; j < GetSplitchildEditVal.length; j++)
                {
                    if(sender.get_text()==GetSplitchildEditVal[j])
                    {
                        alert("Already Selected")
                        return false;
                    }
                }
            }
            var GetMultiples = sender.get_value()
            var newval=document.getElementById ("Hidnew").value
            var GetSplitVal = newval.split(",")
            for(i = 1; i < GetSplitVal.length; i++)
            {
                if(sender.get_value()==GetSplitVal[i])
                {
                    alert("Already Selected")
                    return false;
                }
            }
            document.getElementById ("Hidnew").value += "," + GetMultiples
            var alreadyopend=document.getElementById ("Hidoldmetaid").value
            var GetSplitoldVal = alreadyopend.split(",")
            for(k = 1; k < GetSplitoldVal.length; k++)
            {
                if(sender.get_value()==GetSplitoldVal[k])
                {
                    document.getElementById("divremove"+ sender.get_value()).style.display="inline"
                    return false;
                }
            }
            document.getElementById ("Hidoldmetaid").value += "," + GetMultiples
           
           
            sTable = "<table cellpadding=0 cellspacing=0  border=0 width=100%><tr><td>"
            if(sender.get_value()==sender.get_value())
            {
                sTable +="<div id=divremove"+ sender.get_value() + "><table cellpadding=0 cellspacing=0  border=0 width=100%>"
                sTable += "<tr><td align=center colspan =2><input type=hidden id=hidmetalist" + sender.get_value() + " value=" + sender.get_text()+ "></td></tr>"
                sTable += "<tr><td align=right valign=top width=40%>" + sender.get_text() + "&nbsp;:&nbsp;" + "</td><td align=left width=60%><textarea id=txtarea" + sender.get_value() + " style=width:270px ></textarea>&nbsp;&nbsp;<a id=removelink" +  sender.get_value() + " style=cursor:pointer;text-decoration:underline; onclick=fn_remove('"+ sender.get_value()+ "')>Remove</a></td></tr>"
                sTable +="</table></div>"
            }
            sTable += "</td></tr></table>"
            document.getElementById("DivIncrement").innerHTML += sTable
           
           
        } 
        function fn_remove(obj)
        {
            var newval1=document.getElementById ("Hidnew").value
            var GetSplitVal1 = newval1.split(",")
            var splitassign=""
            for(i = 1; i < GetSplitVal1.length; i++)
            {
                if(obj==GetSplitVal1[i])
                {
                    document.getElementById ("divremove"+GetSplitVal1[i]).style.display="none"
                    GetSplitVal1[i]=""
                }
                splitassign += "," + GetSplitVal1[i]
            }
            var splitcommo=""
            splitcommo =splitassign.split(",")
            var splitcommoassign=""
            for(j = 1; j < splitcommo.length; j++)
            {
            // alert(splitcommo[j])
                if(splitcommo[j]!="")
                {
                    splitcommoassign += "," + splitcommo[j]
                }
            }
            document.getElementById ("Hidnew").value=""
            document.getElementById ("Hidnew").value=splitcommoassign
            //  alert(document.getElementById ("Hidnew").value)
        }
        function fn_metaupdatechild()
        {  
            if(document.getElementById("hiddtestforedit").value!="")
            {
                var EditNameID=document.getElementById("hiddtestforedit").value
                if(document.getElementById(EditNameID).value=="")
                {
                    document.getElementById("divlblName").innerHTML ="Enter Name"
                    return false;
                }
                if(document.getElementById("hiddtestforeDesc").value !="")
                {
                    var EditDescID=document.getElementById("hiddtestforeDesc").value
                    if(document.getElementById(EditDescID).value=="")
                    {
                        document.getElementById("divlblDesc").innerHTML="Enter Description"
                        return false;
                    }
                }
                 var ChecknewduplicEdit=""
                 var duplicat=""
                 duplicat=document.getElementById("hiddcheck").value
                 ChecknewduplicEdit=selectduplicatename(document.getElementById(EditNameID).value,document.getElementById("HidClientName").value,duplicat)
                 if(ChecknewduplicEdit!=false)
                    {  
                        document.getElementById("divlblName").innerHTML ="Name Exists"
                        return false;
                    } 
            }
            if(document.getElementById("hiddcheck").value=="")
            {   if(document.getElementById("RadGrid1$ctl00$ctl02$ctl03$txtName").value=="")
                {
                    document.getElementById("divlblName").innerHTML ="Enter Name"
                    return false
                }
                else
                {
                    document.getElementById("divlblName").innerHTML =""
                }
                if(document.getElementById("RadGrid1$ctl00$ctl02$ctl03$txtDesciption").value=="")
                {
                    document.getElementById("divlblDesc").innerHTML="Enter Description"
                    return false
                }
                else
                {
                    document.getElementById("divlblDesc").innerHTML=""
                }
            }
            if(document.getElementById ("Hidnew").value !="")
            {
                var newval1=document.getElementById ("Hidnew").value
                var GetSplitVal1 = newval1.split(",")
                var splitassign=""
                for(j = 1; j < GetSplitVal1.length; j++)
                {
                    if(document.getElementById("txtarea"+GetSplitVal1[j]).value=="")
                    {
                        alert("Enter Selected Metatag Values")
                        return false
                    }
                }
                var Checknewduplicate=""
                var duplicateeditid=""
                if(document.getElementById("hiddcheck").value=="")
                 {
                    Checknewduplicate=selectduplicatename(document.getElementById("RadGrid1$ctl00$ctl02$ctl03$txtName").value,document.getElementById("HidClientName").value,duplicateeditid)
                 }
                 if(Checknewduplicate!=false)
                    {  
                        document.getElementById("divlblName").innerHTML ="Name Exists"
                        return false;
                    } 
                var CleintNames = document.getElementById("HidClientName").value
                var Check = SelectMetamaxId(CleintNames)
                //alert(Check)
                var dropvalue= document.getElementById ("Hidnew").value
                var GetSplitVal = dropvalue.split(",")
                for(i = 1; i < GetSplitVal.length; i++)
                {
                    var  metalistval=document.getElementById("hidmetalist"+GetSplitVal[i]).value
                    var metadiscipval=document.getElementById("txtarea"+GetSplitVal[i]).value
                    if(document.getElementById("hiddcheck").value=="")
                    {
                    InsertMetachildrecords(CleintNames,metalistval,metadiscipval,Check)
                    }
                    else
                    {
                    InsertMetachildrecords(CleintNames,metalistval,metadiscipval,document.getElementById("hiddcheck").value)
                    }
                }
                 if(document.getElementById("hiddcheck").value=="")
                 {
                    InsertMetaParentrecords(CleintNames,document.getElementById("RadGrid1$ctl00$ctl02$ctl03$txtName").value,document.getElementById("RadGrid1$ctl00$ctl02$ctl03$txtDesciption").value,Check)
                 }
            }
           //check
               if(document.getElementById("hiddEditMetachildid").value=="" && document.getElementById ("Hidnew").value=="")
                {
                    alert("Select Metatag List")
                    return false
                }
               
              //edit old updateval for update Records  
            if(document.getElementById("hiddEditMetachildid").value!="")
            {
                var newvalt=document.getElementById("hiddEditMetachildid").value
                var GetSplitValt = newvalt.split(",")
                var splitassign=""
                for(m = 1; m < GetSplitValt.length; m++)
                {
                    if(document.getElementById("txtEditarea"+GetSplitValt[m]).value=="")
                    {
                        alert("Enter Selected Metatag Values")
                        return false
                    }
                }
                var dropvaluek= document.getElementById("hiddEditMetachildid").value
                var GetSplitValk = dropvaluek.split(",")
                var CleintNamesk = document.getElementById("HidClientName").value
                for(n = 1; n < GetSplitValk.length; n++)
                {
                    var metadiscipvalk=document.getElementById("txtEditarea"+GetSplitValk[n]).value
                    var exits=UpdateMetachildrecords(CleintNamesk,metadiscipvalk,GetSplitValk[n])
                }
            }
          
        }
        function fn_changeName(cmp)
        {  
            var Check =""
            var duplicateeditid="" 
            if(document.getElementById(cmp.name).value!="")
            {
                document.getElementById("divlblName").innerHTML =""
            }
            document.getElementById ("HiddMetaName").value=cmp.name
            var Get = document.getElementById(cmp.name).value
            document.getElementById("hiddtestforedit").value=cmp.name
        }
        function fn_change(cmp)
        {
            if(document.getElementById(cmp.name).value!="")
            {
                document.getElementById("divlblDesc").innerHTML=""
            }
            document.getElementById("hiddtestforeDesc").value=cmp.name
        }
        function DeleteHiddenvalue()
        {
            document.getElementById("Hidnew").value=""
            document.getElementById("Hidoldmetaid").value=""
            document.getElementById("HiddMetaName").value=""
            document.getElementById("hiddEditMetachildid").value=""
            document.getElementById("hiddgetEditdropval").value=""
            document.getElementById("hiddEditmetarefid").value=""
            document.getElementById("hiddcheck").value=""
            document.getElementById("hiddtestforedit").value=""
        }
        function EditChildRecords(Metaref)
        {
            var DS = ""
            var sTable=""
            document.getElementById("hiddgetEditdropval").value=""
            document.getElementById("hiddEditMetachildid").value=""
            var metarefid=Metaref
            var metachildsid=""
            var metachildname=""
            document.getElementById("hiddcheck").value=metarefid

            var CleintNames = document.getElementById("HidClientName").value
            sTable = "<table cellpadding=0 cellspacing=0  border=0 width=100%><tr><td>"
            DS = selectChildRecord(metarefid,CleintNames)
            if(DS != null)  
            {
                if(DS.Tables[0].Rows.length > 0)
                {
                    for(i=0;i<DS.Tables[0].Rows.length;i++)
                    {
                        var DR = DS.Tables[0].Rows[i]
                        sTable +="<div id=divEditremove"+ DR.metatagchildid + "><table cellpadding=0 cellspacing=0  border=0 width=100%>"
                        sTable += "<tr><td align=center colspan =2><input type=hidden id=hidEditmetalist" + DR.metatagchildid + " value=" + DR.tagcaption + "></td></tr>"
                        sTable += "<tr><td align=center colspan =2><input type=hidden id=hidEditmetalistVal" + DR.metatagchildid + " value=" + DR.tagvalue + "></td></tr>"
                        sTable += "<tr><td align=right valign=top width=40%>" + DR.tagcaption + "&nbsp;:&nbsp;" + "</td><td align=left width=60%><textarea id=txtEditarea" + DR.metatagchildid + " style=width:270px>"+ DR.tagvalue +"</textarea>&nbsp;&nbsp;<a id=removeEditlink" +  DR.metatagchildid + " style=cursor:pointer;text-decoration:underline; onclick=fn_Editremove('"+ DR.metatagchildid+ "')>Remove</a></td></tr>"
                        sTable +="</table></div>"
                        metachildsid += "," + DR.metatagchildid
                        metachildname += "," + DR.tagcaption
                    }
                }
            }
            sTable += "</td></tr></table>"
            document.getElementById("DivEditRecordDisplay").innerHTML += sTable
            //alert(metachildsid)
            //alert(metachildname)
            document.getElementById("hiddEditMetachildid").value=metachildsid
            document.getElementById("hiddgetEditdropval").value=metachildname
        }
        function fn_Editremove(metaref)
        {
            var metachildname=""
            var metarefid=metaref
            document.getElementById("hiddEditmetarefid").value=metarefid
            var CleintNames = document.getElementById("HidClientName").value
            Deletemetachild(metarefid,CleintNames)
            document.getElementById("divEditremove"+metarefid).style.display="none"
            var removechildcaption=document.getElementById("hidEditmetalist"+metarefid).value
            var newval=document.getElementById("hiddgetEditdropval").value
            var GetSplitVal = newval.split(",")
            for(j = 0; j < GetSplitVal.length; j++)
            {
                if(removechildcaption==GetSplitVal[j])
                {
                    GetSplitVal[j]=""
                }
                metachildname += "," + GetSplitVal[j]
            }
            var splitcommo=""
            splitcommo =metachildname.split(",")
            var splitcommoassign=""
            for(k = 1; k < splitcommo.length; k++)
            {
                if(splitcommo[k]!="")
                {
                    splitcommoassign += "," + splitcommo[k]
                }
            }
            document.getElementById("hiddgetEditdropval").value=""
            document.getElementById("hiddgetEditdropval").value=splitcommoassign
            var metachildnames=""
            var newvals=document.getElementById("hiddEditMetachildid").value
            var GetSplitVals = newvals.split(",")
            for(m = 0; m < GetSplitVals.length; m++)
            {
                if(metarefid==GetSplitVals[m])
                {
                    GetSplitVals[m]=""
                }
                metachildnames += "," + GetSplitVals[m]
            }
            var splitcommos=""
            splitcommos =metachildnames.split(",")
            var splitcommoassigns=""
            for(n = 1; n < splitcommos.length; n++)
            {
                if(splitcommos[n]!="")
                {
                    splitcommoassigns += "," + splitcommos[n]
                }
            }
            document.getElementById("hiddEditMetachildid").value=""
            document.getElementById("hiddEditMetachildid").value=splitcommoassigns
        }

    </script>
        <body>
            <form id="form1" runat="server">
                <TPSiteMap:TNSiteMap ID="SiteMap1" runat="server" />
                <input type="hidden" id="hiddcheck" runat="server" value="" />
                <input type="hidden" id="Hidnew" runat="server" value="" />
                <input type="hidden" id="Hidoldmetaid" runat="server" value="" />
                <input type="hidden" id="HidClientName" runat="server" value="" />
                <input type="hidden" id="HiddMetaName" runat="server" value="" />
                <input type="hidden" id="hiddMetatagdeleteid" runat="server" value="" />
                <input type="hidden" id="hiddEditMetachildid" runat ="server" value="" />
                <input type ="hidden" id="hiddgetEditdropval" runat ="server" value="" />
                <input type="hidden" id="hiddEditmetarefid" runat ="server" value="" />
                <input type="hidden" id="hiddtestforedit" runat="server" value="" />
                <input type="hidden" id="hiddtestforeDesc" runat="server" value="" />
                <div>
                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr>
                            <td style="height: 30px;padding-left:10px">
                            <span style="font-family:Verdana; font-size:10; font-weight:bold;"></span>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                <tr>
                                    <td style="padding-left:10px">
                                        <asp:ScriptManager ID="ScriptManager1" runat="server">
                                        </asp:ScriptManager>
                                        <telerik:RadAjaxManager id="RadAjaxManager1" runat="server">
                                            <AjaxSettings>
                                                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                                                    <UpdatedControls>
                                                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>
                                                        <telerik:AjaxUpdatedControl ControlID="lblMsg" />
                                                    </UpdatedControls>
                                                </telerik:AjaxSetting>
                                            </AjaxSettings>
                                        </telerik:RadAjaxManager>
                                        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="50">
                                            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
                                        </telerik:RadAjaxLoadingPanel>
                                        <telerik:RadGrid ID="RadGrid1" CssClass="RadGrid" EnableTheming="False" EnableEmbeddedBaseStylesheet="False" AllowSorting="True" AllowMultiRowSelection="true" AllowMultiRowEdit="false"
                                            runat="server" Width="98%" ShowStatusBar="true" AllowPaging="True" AutoGenerateColumns="False" PageSize="5" AllowAutomaticDeletes="True" ClientSettings-AllowColumnsReorder="true"  >
                                            <ItemStyle CssClass="RadGridItem"></ItemStyle>
                                            <HeaderStyle CssClass="RadGridHeader"></HeaderStyle>
                                            <PagerStyle Mode="Slider" alwaysvisible="True" pagebuttoncount="5" CssClass="RadGridPager" HorizontalAlign="Left" ></PagerStyle>
                                            <ClientSettings EnablePostBackOnRowClick="false">
                                                <Selecting AllowRowSelect="true" />
                                            </ClientSettings>
                                            <MasterTableView CommandItemDisplay="Top" ClientDataKeyNames="metatagrefid"  DataKeyNames="metatagrefid" Width="100%" AutoGenerateColumns="False" NoMasterRecordsText="No Records found to display">
                                            <CommandItemTemplate>
                                                <table cellpadding ="0" cellspacing ="0" border ="0" width ="100%">
                                                    <tr>
                                                        <td align="left" style="padding:10px;" valign="middle">
                                                            <table border="1" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td>&nbsp;Filter : &nbsp;</td>
                                                                    <td><asp:TextBox  autocomplete="off"  ID="txtSearch" runat="server" OnTextChanged="txtSearch_TextChanged" EnableTheming ="true"></asp:TextBox>&nbsp;
                                                                        <telerik:RadCombobox ID="rcbFieldName" runat="server"  AllowCustomText="True" width="140px" EmptyMessage="-------Select-------" CausesValidation="false">
                                                                            <Items>
                                                                                <telerik:RadComboBoxItem Text="Name" Value="Name" />
                                                                                <telerik:RadComboBoxItem Text="Description" Value="description" />
                                                                            </Items>
                                                                        </telerik:RadCombobox>&nbsp;
                                                                        <asp:ImageButton ID="btnSearch" runat="server" CommandName="btnSearch" ImageUrl="~/Images/icons/Search.gif" ImageAlign="Bottom"  CausesValidation="false"/>
                                                                    </td>
                                                                </tr>
                                                           </table>
                                                        </td>
                                                        <td align="right" style="padding:10px;" valign="middle">
                                                            <table border="1" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td>
                                                                        <asp:LinkButton Style="vertical-align: bottom" ID="btnEditSelected" runat="server"
                                                                        CommandName="EditSelected" CausesValidation="false"  OnClientClick="return IsGridItemsSelected('Edit')" Visible='<%# RadGrid1.EditIndexes.Count = 0 %>' ><img style="border:0px;vertical-align:middle;" alt="" src="../Images/icons/Edit.gif" /> Edit </asp:LinkButton>
                                                                        <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="../Images/icons/Save.gif" /> Update </asp:LinkButton>
                                                                        &nbsp;
                                                                        <asp:LinkButton ID="btnInsert" runat="server" CommandName="InitInsert" Visible='<%# Not RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../Images/icons/Add.gif" /> Add </asp:LinkButton>&nbsp;
                                                                        <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" CausesValidation="false" Visible='<%# RadGrid1.EditIndexes.Count > 0 Or RadGrid1.MasterTableView.IsItemInserted %>' OnClientClick="DeleteHiddenvalue()"><img style="border:0px;vertical-align:middle;" alt="" src="../Images/icons/Cancel.gif" /> Cancel</asp:LinkButton>
                                                                        &nbsp;&nbsp;
                                                                        <asp:LinkButton ID="btndelete"
                                                                        runat="server" CommandName="DeleteSelected" CausesValidation="false"   OnClientClick="javascript:return IsGridItemsSelected('Delete')? confirm('Confirm to delete'):false;" ><img style="border:0px;vertical-align:middle;" alt="" src="../Images/icons/Delet.gif" /> Delete </asp:LinkButton>
                                                                        &nbsp;&nbsp;&nbsp;
                                                                        <asp:LinkButton ID="btnrefresh" runat="server" OnClick="clrFilters_Click" ><img style="border:0px;vertical-align:middle;" alt="" src="../Images/icons/Refresh.gif" /> Refresh </asp:LinkButton>
                                                                    </td>
                                                               </tr>
                                                           </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </CommandItemTemplate>
                                            <Columns>
                                                <telerik:GridTemplateColumn UniqueName="SrlNo" AllowFiltering="False">
                                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
                                                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblSrlNo"  runat="server" />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridClientSelectColumn UniqueName="column">
                                                    <ItemStyle Width="10px" HorizontalAlign="Left" VerticalAlign="Middle"></ItemStyle>
                                                    <HeaderStyle Width="10px" HorizontalAlign="Left" VerticalAlign="Middle"></HeaderStyle>
                                                </telerik:GridClientSelectColumn>
                                                <telerik:GridBoundColumn DataField="metatagrefid" UniqueName="metatagrefid"  ReadOnly="True" Display="false" ></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn  DataField="Name" UniqueName="Name" SortExpression="Name" HeaderText="Name" ShowSortIcon="False"  >
                                                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                                                    <HeaderStyle HorizontalAlign="Left" VerticalAlign="Middle"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="description" UniqueName="description" HeaderText="Description" ShowSortIcon="false" >
                                                    <ItemStyle HorizontalAlign="Left" />
                                                </telerik:GridBoundColumn>
                                            </Columns>
                                            <EditFormSettings  EditFormType="Template"  >
                                                <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                                                <FormCaptionStyle CssClass="RadGridHeader"></FormCaptionStyle>
                                                <FormMainTableStyle BackColor="White" GridLines="Horizontal" CellPadding="3" Width="100%" CellSpacing="0"></FormMainTableStyle>
                                                <FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px" BackColor="White" />
                                                <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                                                <EditColumn CancelText="Cancel edit" InsertText="Insert Order"  UniqueName="EditCommandColumn1" ButtonType="ImageButton" UpdateText="Update record">
                                                </EditColumn>
                                                <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                                                    <FormTemplate >
                                                        <table cellpadding="0"  cellspacing="0" width="100%" border="0">
                                                            <tr><td style="height:3px;" colspan ="2"></td></tr>
                                                            <tr>
                                                                <td align="right" colspan="2">
                                                                    <asp:ImageButton ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' ImageUrl="~/Images/icons/Update.gif"
                                                                    runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' OnClientClick="return fn_metaupdatechild()">
                                                                    </asp:ImageButton>&nbsp;
                                                                    <asp:ImageButton ID="Button1" Text="Cancel" runat="server" CausesValidation="False" ImageUrl="~/Images/icons/CancelEdit.gif"
                                                                    CommandName="Cancel" OnClientClick="DeleteHiddenvalue()"></asp:ImageButton>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td width="53%">
                                                                    <div id="Divadd"  runat="server">
                                                                        <table cellpadding ="0" cellspacing ="0" border ="0" align ="center" width ="100%" >
                                                                            <tr>
                                                                                <td width="30%" align="right">Name <font color="red" >*</font>:&nbsp;</td>
                                                                                <td align="left">
                                                                                    <table cellpadding="0" cellspacing="0" border="0">
                                                                                        <tr>
                                                                                            <td>
                                                                                                <input type="hidden" id="hiddGetreffid" runat ="server" value='<%#Eval("metatagrefid") %>' />
                                                                                                <asp:TextBox ID="txtName" runat="server" EnableTheming ="true" Text='<%#Eval("name") %>' onchange="fn_changeName(this)"></asp:TextBox>&nbsp;
                                                                                            </td>
                                                                                            <td valign="middle">
                                                                                                <div id="divlblName" class="errormsg"></div>
                                                                                            </td>
                                                                                        </tr>
                                                                                    </table>
                                                                                </td>
                                                                            </tr>
                                                                            <tr><td colspan ="2" height="4px"></td></tr>
                                                                            <tr>
                                                                                <td width="30%" align="right" valign="top">Description <font color="red" >*</font>:&nbsp;</td>
                                                                                <td align="left" valign="top" width="70%">
                                                                                    <table cellpadding="0" cellspacing="0" border="0">
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:TextBox ID="txtDesciption" runat="server" EnableTheming ="true" Text='<%#Eval("description") %>' TextMode ="MultiLine" style="height:60px;width:200px;" onchange="fn_change(this)"></asp:TextBox>&nbsp;
                                                                                            </td>
                                                                                            <td valign="bottom" align="left">
                                                                                                <div id="divlblDesc" class="errormsg"></div>
                                                                                            </td>
                                                                                        </tr>
                                                                                    </table>
                                                                                </td>
                                                                            </tr>
                                                                            <tr><td colspan ="2" align="center">&nbsp;</td></tr>
                                                                            <tr>
                                                                                <td colspan="2" align="center" width="100%">
                                                                                    <div id="divmulticombo">
                                                                                        <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
                                                                                            <tr>
                                                                                                <td align="right" width="30%">New Metatag List <font color="red" >*</font>:&nbsp;</td>
                                                                                                <td align="left" width="70%">
                                                                                                    <telerik:RadComboBox ID="RdcmpMetalist" runat="server" Width="200px" Height="220px"   MarkFirstMatch="True"  EnableVirtualScrolling="True"  OnClientSelectedIndexChanged="HandleEndChanging">
                                                                                                        <CollapseAnimation Duration="200" Type="OutQuint" />
                                                                                                    </telerik:RadComboBox>&nbsp;
                                                                                                    <asp:RequiredFieldValidator ID="ReqMetaList" CssClass="errormsg" runat="server" ControlToValidate="RdcmpMetalist" Display="Dynamic" ErrorMessage="Select Metatag List"></asp:RequiredFieldValidator>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                            <tr><td colspan ="2" align="center">&nbsp;</td></tr>
                                                                        </table>
                                                                    </div>
                                                                </td>
                                                                <td width="47%" valign="top" align="left">
                                                                    <div align="left" style="overflow:auto; height:150px; width:100%;">
                                                                         <table cellpadding ="0" cellspacing ="0">
                                                                                <tr>
                                                                                    <td colspan="2" width="100%" align="left">
                                                                                        <div id="DivIncrement" align="left"></div>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td colspan="2" width="100%" align="left">
                                                                                        <div id="DivEditRecordDisplay" align="left"></div>
                                                                                    </td>
                                                                                </tr>
                                                                          </table>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                            <tr><td colspan="2" height="2px">&nbsp;</td></tr>                                           
                                                            <tr><td style="height:15px;" align="center" style ="padding-right:60px" colspan="2"><asp:label runat="server" ID="lblEditFormMsg"  CssClass="errormsg"></asp:label></td></tr>
                                                        </table>
                                                    </FormTemplate>
                                                </EditFormSettings>
                                                <ExpandCollapseColumn>
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                </ExpandCollapseColumn>
                                                <RowIndicatorColumn>
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                </RowIndicatorColumn>
                                            </MasterTableView>
                                            <FilterMenu EnableTheming="True" Skin="WebBlue" enableembeddedbasestylesheet="False">
                                                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                            </FilterMenu>
                                            <AlternatingItemStyle CssClass="RadGridItem"></AlternatingItemStyle>
                                            <SortingSettings  SortToolTip="Click here to sort"></SortingSettings>
                                        </telerik:RadGrid>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" height="20px">
                                        <asp:Label ID="lblMsg" runat="server" CssClass="errormsg"></asp:Label><br />
                                    </td>
                                </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </div>
            </form>
        </body>
    </html>












    1)
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 22 Dec 2008 Link to this post

    Hi Ravi,

    You can attach the OnClientClick event of the Update button server-side in the ItemCreated/ItemDataBound event of the grid. Try passing the textboxes ClientIDs as parameters of this client event handler.

    Check it out and let me know if this helps.

    Best wishes,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top