S
sloan
Ok.
In a simple scenario where I have a
MasterPage
Web Content Page (using the just mentioned MasterPage)
and a DropDownList on the content page.
When the page renders, I get something like this:
<select name="ctl00$Master1ContentPlaceHolder1$DropDownList1"
id="ctl00_Master1ContentPlaceHolder1_DropDownList1">
<option value="1">PickMe1</option>
<option value="2">PickMe2</option>
<option value="3">PickMe3</option>
</select>
And when I don't use a master page, I get something like this:
<select name="DropDownList1" id="DropDownList1">
<option value="1">PickMe1</option>
<option value="2">PickMe2</option>
<option value="3">PickMe3</option>
</select>
I've been trying to move some 1.1 code up to 2.0, and I had to some up with
something to work with MasterPages.
I have some custom javascript creation code, and I'm trying to get
"what the rendered name will be"
code put together.
This is what I got so far, though I think I'm missing something:
/////////////// START
private string FindFullyQualifiedControlName(Control c, MasterPage mp)
{
string returnValue = string.Empty;
if (null != mp)
{
if (null != c.NamingContainer)
{
Control nc = c.NamingContainer;
returnValue = nc.ClientID + "_";
}
}
returnValue += c.ID;
return returnValue;
}
/////////////// END
(Yes, I know I shouldn't concat strings together with += .. and I should use
StringBuilder ...... )
Is there a better way to do this?
I have it working. But I'm thinking when I go to creating a Custom Web
Control, this isn't going to work.
Thanks........................
In a simple scenario where I have a
MasterPage
Web Content Page (using the just mentioned MasterPage)
and a DropDownList on the content page.
When the page renders, I get something like this:
<select name="ctl00$Master1ContentPlaceHolder1$DropDownList1"
id="ctl00_Master1ContentPlaceHolder1_DropDownList1">
<option value="1">PickMe1</option>
<option value="2">PickMe2</option>
<option value="3">PickMe3</option>
</select>
And when I don't use a master page, I get something like this:
<select name="DropDownList1" id="DropDownList1">
<option value="1">PickMe1</option>
<option value="2">PickMe2</option>
<option value="3">PickMe3</option>
</select>
I've been trying to move some 1.1 code up to 2.0, and I had to some up with
something to work with MasterPages.
I have some custom javascript creation code, and I'm trying to get
"what the rendered name will be"
code put together.
This is what I got so far, though I think I'm missing something:
/////////////// START
private string FindFullyQualifiedControlName(Control c, MasterPage mp)
{
string returnValue = string.Empty;
if (null != mp)
{
if (null != c.NamingContainer)
{
Control nc = c.NamingContainer;
returnValue = nc.ClientID + "_";
}
}
returnValue += c.ID;
return returnValue;
}
/////////////// END
(Yes, I know I shouldn't concat strings together with += .. and I should use
StringBuilder ...... )
Is there a better way to do this?
I have it working. But I'm thinking when I go to creating a Custom Web
Control, this isn't going to work.
Thanks........................