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$Mas ter1ContentPlac eHolder1$DropDo wnList1"
id="ctl00_Maste r1ContentPlaceH older1_DropDown List1">
<option value="1">PickM e1</option>
<option value="2">PickM e2</option>
<option value="3">PickM e3</option>
</select>
And when I don't use a master page, I get something like this:
<select name="DropDownL ist1" id="DropDownLis t1">
<option value="1">PickM e1</option>
<option value="2">PickM e2</option>
<option value="3">PickM e3</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 FindFullyQualif iedControlName( Control c, MasterPage mp)
{
string returnValue = string.Empty;
if (null != mp)
{
if (null != c.NamingContain er)
{
Control nc = c.NamingContain er;
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......... ............... 3 2089
"sloan" <sl***@ipass.ne twrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Is there a better way to do this?
<script type="text/javascript">
function validateForm()
{
if(document.get ElementById('<% =DropDownList1. ClientID%>').va lue == "")
{
alert('DropDown List1 cannot be blank');
document.getEle mentById('<%=Dr opDownList1.Cli entID%>').focus ();
return false;
}
}
</script>
Duh...
Ok, I screwed that one up.
Thanks Mark, I got it now.
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:ub******** ******@TK2MSFTN GP02.phx.gbl...
"sloan" <sl***@ipass.ne twrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Is there a better way to do this?
<script type="text/javascript">
function validateForm()
{
if(document.get ElementById('<% =DropDownList1. ClientID%>').va lue == "")
{
alert('DropDown List1 cannot be blank');
document.getEle mentById('<%=Dr opDownList1.Cli entID%>').focus ();
return false;
}
}
</script>
"sloan" <sl***@ipass.ne twrote in message
news:ej******** ********@TK2MSF TNGP03.phx.gbl. ..
Duh...
Ok, I screwed that one up.
Thanks Mark, I got it now.
We've all been there, mate... :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Leffe Andersson |
last post by:
Hi folks!
I have a MasterPage with some public methods, and I would like to call them
from a (app_code) class. Is it possible to set a directive or an assembly
reference to a MasterPage from a normal class?
I have no problem to call the masterpage's methods from a contentpage, but
what I would like to do is someting like this...
public partial class MyMaster : System.Web.UI.MasterPage
|
by: User |
last post by:
OK, I asked in a reply, but I've wasted far too long so I'm going to put
a new post out there in hopes that it will be more visible.
I have a MasterPage. I want to call a method declared in that class from
a Page that uses the MasterPage. How do I do that?
public partial class List : System.Web.UI.MasterPage
{
protected ArrayList m_SortList;
|
by: Alex Maghen |
last post by:
Hi. I'm a little confused about the code that resides in the code-behind of a
MasterPage and the code that resides in the code-behind of the actual pages
that USE that MasterPage.
I'm noticing, for example, that the Page_Load on the specific page executes
before the Page_Load of its MasterPage. Is this right? But what I really want
to understand is VARIABLE SCOPE, etc. between the two.
For example: Is there a way for me to write code...
|
by: Islamegy® |
last post by:
In my project i have two master page which i change dynamic in runtime.. The
first one with 1 ContentPanel "onepanel.master", the second with 2
contentPanel"twopanel.master"..
but when i switch between them it don't work, if the default masterpage is
"onepanel.master" and try to change it in runtime, ContentPanel2 which is
exist in the loaded masterpage throw exception..
the same happen if the default is "twopanel.master" and switch it...
|
by: cevans |
last post by:
Is there a way to load a MasterPage programmatically? Not switch a
page's masterpage but to create a MasterPage object that holds a given
masterpage. So I know I can do:
MasterPage master = new MasterPage();
But there is no way to do something like:
MasterPage master = new MasterPage("~/default.master");
| |
by: ThunderMusic |
last post by:
Hi,
Maybe there is another way of doing this, but here's my problem...
I have my web site where I have a master page to have a common layout and a
common behavior on all my pages (that's what it's intended for)... But now
here comes the time where some pages need some processing (like, is the user
logged? and those kind of things)... If it was only on 1 or 2 pages, I'd
says, i'll put it directly in the code and case closed, but there...
|
by: =?Utf-8?B?QmVuIFIu?= |
last post by:
Hi,
WHen I specify my master page in the page's @Page directive, no problems.
However, when I put it ias an attribute in Web.config's page element, the
designer fails. It just says "Error Creating Control - Content. Content
controsl can only be used in a content page." I know that there's an issue w/
nested masters, but I'm only trying to use one. Interestingly, if I run the
site, it builds and displays properly despite this error. Any...
|
by: Bon |
last post by:
Dear all
I create a master page with image buttons on the left-hand side for
navigation. When a user clicks the student button, the content (i.e.
ContentPlaceholder) in masterpage will be changed from default.aspx to
students.aspx.
I tried to create a subroutine in MasterPage.master.vb to do it. The
code is as following. But, the default.aspx's content is shown in
MasterPage even I clicked the student button.
|
by: Frank Milverckowitz |
last post by:
Hi,
New to .NET... question about Masterpages vs. using Frameset
I'm using Visual Studio 2005 and notice that the generated pages are of
DTD/Doctype that don't support framesets. To use framesets I will be
changing all pages to HTML 4.0 loose.dtd.
I have a demand from my boss to use framesets to create a "keep-alive"
feature using a parent frame + ajax call on a time interval. (i.e. have the
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |