Master page in ASP.Net

Fuma

Executive Member
Joined
Jul 9, 2007
Messages
5,111
I have a master page in this web project I'm busy with.

The problem is I can't seem to change the form name.

Code:
<form id="Customers" runat="server">

</form>

but it is rendered as:
Code:
<form name="aspnetForm" id="aspnetForm">
Is the a way around this?

I also have a FormView that has a couple of RadioButtonList and the client renders those radio buttons as:
Code:
<input id="[B]ctl00_bottom[/B]_FormView1_RadioButtonList1_0" type="radio" name="[B]ctl00$bottom$FormView1$RadioButtonList1[/B]">
I need to do some JavaScript and this is not working.
 

Fuma

Executive Member
Joined
Jul 9, 2007
Messages
5,111
No, for programming
Nah. I taught myself 90% of what I know programming and also learned from other people.

Been to your "training" and it was a complete waste of time. I don't know what gave you that idea that I don't know how to "program".

Thanks anyway.
 

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
If you need to do master-pages and Javascript, the easiest would be to reference the control by it's ClientID property. An example is as follows:

Code:
function DoStuff() {
    var someControl = document.getElementById("<%=ServerSideControl.ClientID %>");
    alert(someControl.id);
}
 

Fuma

Executive Member
Joined
Jul 9, 2007
Messages
5,111
If you need to do master-pages and Javascript, the easiest would be to reference the control by it's ClientID property. An example is as follows:

Code:
function DoStuff() {
    var someControl = document.getElementById("<%=ServerSideControl.ClientID %>");
    alert(someControl.id);
}

I have decided to go that route:
Code:
    Private Function GetClientID(ByVal somePanel As String, ByVal someControlName As String, ByVal index As Integer) As String
        Return FormView1.FindControl(somePanel ).FindControl(someControlName).ClientID + "_" + index.ToString()
    End Function
and call that function when I build the JavaSccript. I still don't understand why the masterpage's form id (aspnetForm) can't change.
 

trancehead

Active Member
Joined
Aug 2, 2005
Messages
97
Have you tried MVC? Much better when it comes to Id's. Also .NET 4 is supposed to allow you to set your own Id's for a control.
 

guest2013-1

guest
Joined
Aug 22, 2003
Messages
19,800
I'm an advocate for self-taught people, you should know that, but re:

I don't know what gave you that idea that I don't know how to "program".

The type of questions you ask is what gave me that idea, easily solve-able and search friendly questions that a quick search in Google would give you the answers to. I'm all for asking opinions on things, especially when it's logic orientated, and I too sometimes post questions neither I (or to me, Google) doesn't know, which that some of the members on here might be able to help with, but like I said. Your questions appear to be more of an "Hey, do my job for me cause I can't figure this out and I'm too lazy to look for an answer" type vibe.

But that might just be me picking on a vibe that might not exist even
 
Top