textbox control ID

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
cgreathouse
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 21
Joined: Tue Mar 03, 2009 10:49 am

textbox control ID

Post by cgreathouse » Fri Apr 03, 2009 7:45 am

Hello

I have a product page that is created from a product template. The template has a number of text boxes on it. I know what the InputFieldIds associated with those text boxes are. Is the a way to find the control.ID of a text box when all I have is a InputFieldId?

For example I know the InputFieldId for one of the text boxes is 30. When I look at the control.ID I get something like ctl00_wpm_ShowProduct_ctl06_InputField_30. Does anybody know how this long ID gets generated? Is there something I can use where I can specify the InputFieldId and get back this ID?

Thanks!

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: textbox control ID

Post by mazhar » Fri Apr 03, 2009 8:03 am

When these textboxes are going to be added to page you can get this id through ClientId property. For example

Code: Select all

if(o is TextBox)
{
string controlId = o.ClientId;
.....
.....
}
When you need to find the control you need to use above id for example

Code: Select all

Control control = PageHelper.RecursiveFindControl(this,clientId);

Post Reply