The function of ASP.net jqurey to modify and check the imitated GridView

Source: Internet
Author: User

Jqurey Code section:

<script type= "Text/javascript" > var flag = 0; Add new Row function AddRow () {var nrow = ' <tr><td><input name= ' hideid ' type= ' hidden ' V Alue= '/><input name= ' username ' type= ' text ' value= ' ' size= ' maxlength= ' Select Name= ' seltype ' id=seltype1><option value= ' text ' > TextBox </option><option value= ' textarea ' > Multi-text Area </option><option value= ' Select ' > Dropdown box </option><option value= ' Radio ' > Radio box </option ><option value= ' checkbox ' > CheckBox </option></select></td><td><span class= ' heb ' Name= ' Buttonspan ' ><input value= ' add ' onclick= ' AddData (this) ' type= ' button ' class= ' Se_buton '/>&nbsp; <input value= ' Cancel ' type= ' button ' onclick= ' Deletenewrow (this) ' class= ' Se_buton '/></span></td></  
            Tr> ";  
                if (flag = = 0) {$ (' #attributetable '). Append (Nrow);  
flag = 1;            }//Add data from new row to background function addData (obj) {var tr  
            obj = $ (obj). Parents (' tr ');  
            var username = $ (trobj). Find (': Text[name=username] '). Val ();  
     
            var SelType = $ (trobj). Find (' select[name=seltype] '). Val (); $.post ("Supplyajax.aspx", {username:username, Seltype:seltype, type: "Add"}, function (data) {if (d  
                    Ata.tostring ()!= "0") {$ (trobj). Find (': Hidden[name=hideid] '). Val (data.tostring ());  
                Changedisable (obj, 0);  
                    else {deletenewrow (obj);  
                Alert (' Add failed ');  
            }  
            });  
        Flag = 0; }//Update row function Upddata (obj) {var trobj = $ (ob  
            j). Parents (' tr ');  
    var id = $ (trobj). Find (': Hidden[name=hideid] '). Val ();        var username = $ (trobj). Find (': Text[name=usrname] '). Val ();  
            var SelType = $ (trobj). Find (' select[name=seltype] '). Val ();  $.post ("Supplyajax.aspx", {id:id, username:username, Seltype:seltype, type: "Update"}, function (data)  
                {if (data.tostring ()!= "0") {changedisable (obj, 0);  
                else {alert (' update failed ');  
        }  
            });  
            ///delete new line function Deletenewrow (obj) {$ (obj). Parents (' tr '). ReplaceWith (');  
        Flag = 0;  
            //Delete Row function deleterow (obj) {var trobj = $ (obj) in the database. Parents (' tr ');  
            var id = $ (trobj). Find (': Hidden[name=hideid] '). Val (); $.post ("Supplyajax.aspx", {id:id, type: "Delete"}, function (data) {if (data.tostring ()!= "0") { 
                    $ (obj). Parents (' tr '). ReplaceWith (');  
                else {alert (' delete failed ');  
        }  
            });  
            //Change Edit Status function changedisable (obj, type) {var trobj = $ (obj). Parents (' tr ');  
                if (type = = 0) {$ (trobj). Find (': Text ')-attr (' disabled ', ' disabled ');  
                $ (trobj). Find (' select '). attr (' disabled ', ' disabled '); $ (trobj). Find (' Span[name=buttonspan] '). HTML ("<input name= ' GX ' value= ' Update ' type= ' button ' onclick= ' Changedisable" ( this,1) ' class= ' Se_buton '/>&nbsp;<input value= ' delete ' type= ' button ' name= ' qx ' onclick= ' (this) ' class  
            = ' Se_buton '/> ');  
                } if (type = = 1) {$ (trobj). Find (': Text '). attr ("Disabled");  
                $ (trobj). Find (' select '). attr (' disabled ', '); $ (trobj). Find (' Span[name=buttonspan] '). HTML ("<inpuT name= ' GX ' value= ' Determine ' type= ' button ' onclick= ' Upddata (this) ' class= ' Se_buton '/>&nbsp;<input ' ' The "Cancel ' type  
            = ' button ' name= ' qx ' onclick= ' changedisable (this,0) ' class= ' Se_buton '/> '); }} </script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.