简体   繁体   中英

multiple instance of usercontrol in same aspx

Hi i have an usercontrol say: ucCustomer.

there are 3 fields inside this usercontrol: txtBox1 (required, valid input) txtBox2(required) txtBox(required, valid input)

I am using Jquery tabs and in each tab i have a usercontrol.

so when user clicks on continue respective controls inside the usercontrol has to be validated.

I could not achieve grouping for controls. If i have tab1 the controls has to have group_Tab1 and same with tab2 controls have group_Tab2.

So when i click continue i get the controls by group name and validate each fields.

I am using jquery validation for this. Let me know how i can achieve this. Thanks

If you use jQuery and web user controls in aspx, the object name change. txtBox2 => UC_XX1_txtBox2 txtBox2 => UC_XX2_txtBox2 (something like that). You can select all items by selector and get the childs for example:

function XXXX()
{
//Get uc Childrens
 $('#UC_XX2_txtBox2 input').each(function () {

     //validate the fields here
    }

//Get uc Childrens
  var list1=$('#UC_XX1_txtBox2 input') 
  for (var i = 0; i < list1.length; i++) {
     //validate the fields here
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM