473,396 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

UserControl?

I have created the following UserControl (the file is named
LoginForm.ascx):

<script language=VB runat="server">
Public UName As String
Public UPwd As String
Public BColor As String

Public Sub btnSubmit(ByVal obj As Object, ByVal ea As EventArgs)
lblMessage.Text = "UserName : " & uid.Text & "<br>Password : "
& pwd.Text"
End Sub
</script>
<table style="background-color:<%= BColor %>;" cellspacing=5>
<tr>
<td>Login:</td>
<td><asp:TextBox id="uid" runat="server"/></td>
</tr>
<tr>
<td>Password:</td>
<td><asp:TextBox id="pwd" TextMode="Password" runat="server"/></td>
</tr>
<tr>
<td><asp:Button text="SUBMIT" OnClick="btnSubmit" runat="server"/></td>
</tr>
</table>
<asp:Label id="lblMessage" runat="server"/>

& this is the ASPX page (named LoginForm.aspx) that uses the above
UserControl:

<%@ Page Language="VB" %>
<%@ Register TagPrefix="SignIn" TagName="ULogin" Src="LoginForm.ascx"
%>
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
lblMessage.Text = "Properties of the user control: <br>"
lblMessage.Text += "ID: " & UCLoginForm.ID & "<br>"
lblMessage.Text += "UserName: " & UCLoginForm.UName & "<br>"
lblMessage.Text += "Password: " & UCLoginForm.UPwd" & "<br>"
lblMessage.Text += "BackColor: " & UCLoginForm.BColor
End Sub
</script>
<html>
<body>
<form runat="server">
<SignIn:ULogin id="UCLoginForm" UName="MyUName" UPwd="MyPwd"
BColor="pink" runat="server" />
</form>
<asp:Label id="lblMessage" runat="server" />
</body>
</html>

The above code works well but VWD 2005 generates the following warning
for each of the 3 properties of the UserControl i.e."UName", "UPwd" &
"BColor" in LoginForm.aspx (the errors pop-up when the mouse is hovered
over the 3 properties):

Validation (ASP.NET): Attribute 'UName' is not a valid attribute of
element 'ULogin'.

VWD generates the same warning for the properties "UPwd" & "BColor".
Why so inspite of the fact that the ASPX page gets executed in the
browser without any problems?

Getting back to the UserControl file i.e. LoginForm.ascx - VWD
generates the following syntax error pointing to the "table" tag in
LoginForm.ascx:

Validation (Internet Explorer 6): Element 'table' must be included
within a parent element.

VWD also generates the above error pointing to the <ptag.

Apart from this, VWD also generates the following syntax error pointing
to all the "asp" tag prefixes in LoginForm.ascx:

Unrecognized tag prefix or device filter 'asp'.

First of all, can't the "asp" tag prefix be used in an ASCX file? If
not, then what tag prefix need to be used to create the different Web
Server controls in an ASCX file?

Lastly, why is the ASPX page getting executed in the browser without
any problems/errors when both the ASPX & the ASCX files are generating
the above mentioned errors?

Thanks,

Arpan

Jul 26 '06 #1
0 1125

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dave Veeneman | last post by:
Is there a simple way to pass drag-and-drop events to a child control in a UserControl? Here's an example: I have created a UserControl which contains a treeview and some text boxes. I want to...
8
by: Raed Sawalha | last post by:
Hi, I have a strange problem with a usercontrol on a page. The usercontrol dispalyes three categories (From a database) when the user clicks a category they see all the products in a shop for...
2
by: Eric Maia | last post by:
I have two UserControls I am using in a form. These are each also used separately in two other forms. The structure is essentially this: CourseUserControl.ascx - select or enter a course...
2
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
9
by: Marcelo Cabrera | last post by:
Hi, I have a user control that in turn creates a bunch of webcontrols dynamically and handles the events these webcontrols raise. It used to work fine on ASP .Net 1.1 but when compiled on 2.0 it...
5
by: Blue | last post by:
We have a custom word processing type editor built with C# and .NET 2.0 and we need to support typing in languages other than English. I want to be able to use the Windows IME to enter in text...
6
by: MeowCow | last post by:
I have created a UserControl that encapsulates a third party data grid. My goal was to create my own DataSource and DataMember properties that forward the binding to the third party grid, then use...
10
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.