开发者

multiple instance of usercontrol in same aspx

开发者 https://www.devze.com 2023-03-10 23:29 出处:网络
Hi i have an usercontrol say: ucCustomer. there are 3 fields inside this usercontrol: txtBox1 (required, valid input)

Hi i have an usercontrol say: ucCustomer.

there are 3 fields inside this usercontrol: txtBox1 (required, valid input) tx开发者_运维技巧tBox2(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
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号