Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > positioning label+textbox in user control

Reply
Thread Tools

positioning label+textbox in user control

 
 
ton
Guest
Posts: n/a
 
      01-15-2004
Hi,
i want to create a server-site usercontrol to logon a database: It should be
very simple but i cannot get the label en textbox in the write order. I want
domething like

Name : [ tekstbox]
Password [ tekstbox]

Button

as just one usercontrol

can someone help me

thanx

Ton


 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      01-15-2004
code the markup tags in the .ascx file, its just like working on a normal
aspx file with the exception that you cannot add <html><head><body> tags,
shouldnt be very difficult. If you are using vs.net then use the designer
and drag and drop controls into the page, couldnt get simpler

"ton" <(E-Mail Removed)> wrote in message
news:bu6c7r$s3m$(E-Mail Removed)1.nb.home.nl...
> Hi,
> i want to create a server-site usercontrol to logon a database: It should

be
> very simple but i cannot get the label en textbox in the write order. I

want
> domething like
>
> Name : [ tekstbox]
> Password [ tekstbox]
>
> Button
>
> as just one usercontrol
>
> can someone help me
>
> thanx
>
> Ton
>
>



 
Reply With Quote
 
 
 
 
ton
Guest
Posts: n/a
 
      01-15-2004
I'm sorry I do not understand it.
I can place these controls on the webform. But how can I call this form,
from what method or how look the code behind file to get a usercontrol (as a
DLL), which my customers could use.

can you explain this in more detail, or can you give me a link where this is
explained

Ton

"Alessandro Zifiglio" <(E-Mail Removed)> schreef in
bericht news:wOyNb.3548$(E-Mail Removed)...
> code the markup tags in the .ascx file, its just like working on a normal
> aspx file with the exception that you cannot add <html><head><body> tags,
> shouldnt be very difficult. If you are using vs.net then use the designer
> and drag and drop controls into the page, couldnt get simpler
>
> "ton" <(E-Mail Removed)> wrote in message
> news:bu6c7r$s3m$(E-Mail Removed)1.nb.home.nl...
> > Hi,
> > i want to create a server-site usercontrol to logon a database: It

should
> be
> > very simple but i cannot get the label en textbox in the write order. I

> want
> > domething like
> >
> > Name : [ tekstbox]
> > Password [ tekstbox]
> >
> > Button
> >
> > as just one usercontrol
> >
> > can someone help me
> >
> > thanx
> >
> > Ton
> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      01-15-2004
All the basics for user control creating and usage are there on this
tutorial.

http://docs.aspng.com/quickstart/asp...bpagelets.aspx


"ton" <(E-Mail Removed)> wrote in message
news:bu6f4r$mfi$(E-Mail Removed)1.nb.home.nl...
> I'm sorry I do not understand it.
> I can place these controls on the webform. But how can I call this form,
> from what method or how look the code behind file to get a usercontrol (as

a
> DLL), which my customers could use.
>
> can you explain this in more detail, or can you give me a link where this

is
> explained
>
> Ton
>
> "Alessandro Zifiglio" <(E-Mail Removed)> schreef in
> bericht news:wOyNb.3548$(E-Mail Removed)...
> > code the markup tags in the .ascx file, its just like working on a

normal
> > aspx file with the exception that you cannot add <html><head><body>

tags,
> > shouldnt be very difficult. If you are using vs.net then use the

designer
> > and drag and drop controls into the page, couldnt get simpler
> >
> > "ton" <(E-Mail Removed)> wrote in message
> > news:bu6c7r$s3m$(E-Mail Removed)1.nb.home.nl...
> > > Hi,
> > > i want to create a server-site usercontrol to logon a database: It

> should
> > be
> > > very simple but i cannot get the label en textbox in the write order.

I
> > want
> > > domething like
> > >
> > > Name : [ tekstbox]
> > > Password [ tekstbox]
> > >
> > > Button
> > >
> > > as just one usercontrol
> > >
> > > can someone help me
> > >
> > > thanx
> > >
> > > Ton
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
ton
Guest
Posts: n/a
 
      01-17-2004
i've read the article but I just can't get the txtbox en label positioning
the way i want it.
The control will not use the html in the .ascx -file

Do you have a (minor) working sample ?

thanks


Ton

"Alessandro Zifiglio" <(E-Mail Removed)> schreef in
bericht news:MNBNb.3597$(E-Mail Removed)...
> All the basics for user control creating and usage are there on this
> tutorial.
>
> http://docs.aspng.com/quickstart/asp...bpagelets.aspx
>
>
> "ton" <(E-Mail Removed)> wrote in message
> news:bu6f4r$mfi$(E-Mail Removed)1.nb.home.nl...
> > I'm sorry I do not understand it.
> > I can place these controls on the webform. But how can I call this form,
> > from what method or how look the code behind file to get a usercontrol

(as
> a
> > DLL), which my customers could use.
> >
> > can you explain this in more detail, or can you give me a link where

this
> is
> > explained
> >
> > Ton
> >
> > "Alessandro Zifiglio" <(E-Mail Removed)> schreef

in
> > bericht news:wOyNb.3548$(E-Mail Removed)...
> > > code the markup tags in the .ascx file, its just like working on a

> normal
> > > aspx file with the exception that you cannot add <html><head><body>

> tags,
> > > shouldnt be very difficult. If you are using vs.net then use the

> designer
> > > and drag and drop controls into the page, couldnt get simpler
> > >
> > > "ton" <(E-Mail Removed)> wrote in message
> > > news:bu6c7r$s3m$(E-Mail Removed)1.nb.home.nl...
> > > > Hi,
> > > > i want to create a server-site usercontrol to logon a database: It

> > should
> > > be
> > > > very simple but i cannot get the label en textbox in the write

order.
> I
> > > want
> > > > domething like
> > > >
> > > > Name : [ tekstbox]
> > > > Password [ tekstbox]
> > > >
> > > > Button
> > > >
> > > > as just one usercontrol
> > > >
> > > > can someone help me
> > > >
> > > > thanx
> > > >
> > > > Ton
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
ton
Guest
Posts: n/a
 
      01-21-2004
Thank you for your last comment
I do not write a usercontrol since the source of a usercontrol can be
editted by the user, its part of the project. Instead I want to write my own
Custom Servercontrol:

a login dialog. My client gets a DLL which and he can use the custom server
controls on his html page.

I hope you understand what I'm meaning

Ton


"Alessandro Zifiglio" <(E-Mail Removed)> schreef in
bericht news:MNBNb.3597$(E-Mail Removed)...
> All the basics for user control creating and usage are there on this
> tutorial.
>
> http://docs.aspng.com/quickstart/asp...bpagelets.aspx
>
>
> "ton" <(E-Mail Removed)> wrote in message
> news:bu6f4r$mfi$(E-Mail Removed)1.nb.home.nl...
> > I'm sorry I do not understand it.
> > I can place these controls on the webform. But how can I call this form,
> > from what method or how look the code behind file to get a usercontrol

(as
> a
> > DLL), which my customers could use.
> >
> > can you explain this in more detail, or can you give me a link where

this
> is
> > explained
> >
> > Ton
> >
> > "Alessandro Zifiglio" <(E-Mail Removed)> schreef

in
> > bericht news:wOyNb.3548$(E-Mail Removed)...
> > > code the markup tags in the .ascx file, its just like working on a

> normal
> > > aspx file with the exception that you cannot add <html><head><body>

> tags,
> > > shouldnt be very difficult. If you are using vs.net then use the

> designer
> > > and drag and drop controls into the page, couldnt get simpler
> > >
> > > "ton" <(E-Mail Removed)> wrote in message
> > > news:bu6c7r$s3m$(E-Mail Removed)1.nb.home.nl...
> > > > Hi,
> > > > i want to create a server-site usercontrol to logon a database: It

> > should
> > > be
> > > > very simple but i cannot get the label en textbox in the write

order.
> I
> > > want
> > > > domething like
> > > >
> > > > Name : [ tekstbox]
> > > > Password [ tekstbox]
> > > >
> > > > Button
> > > >
> > > > as just one usercontrol
> > > >
> > > > can someone help me
> > > >
> > > > thanx
> > > >
> > > > Ton
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      01-21-2004
hi Ton, the reason i said code the markup in your usercontrol is because you
explicitly stated that you wanted to control placement of Items in your
"UserControl".

Ok, if this is a custom web control, in your CreateChildControls method as
you add your controls that is label + textboxes one of the simplest ways to
go about markup is to try adding them into a table control.

Protected Overrides Sub CreateChildControls()

Dim table As New table()
table.ID = ClientID & "_table"
Controls.Add(table)

Dim r1 As New TableRow()
Dim r2 As New TableRow()
Dim c1 As New TableCell()
Dim c2 As New TableCell()
Dim c3 As New TableCell()
Dim c4 As New TableCell()

c1.controls.add(label1)
c2.controls.add(textbox1)
r1.cells.add(c1)
r1.cells.add(c2)

label1.id = clientID & "_lblusername"
label1.text = "Username:"
textbox1.id = clientID & "_txtusername"


c3.controls.add(label2)
c4.controls.add(textbox2)
r2.cells.add(c3)
r2.cells.add(c4)

'set properties after adding the control to the controls collection
lable2.id = clientID & "_password"
label2.text = "Password:"
textbox1.id = clientID & "_txtpassword"

'now add your two rows to the table
table.rows.add(r1)
table.rows.add(r2)

End sub

this will give you the format :

username : ----------

password : ----------

You can further set fixed styling to the table or expose style as a property
of your control that way you can set it from the properties grid just like
with any web control.

"ton" <(E-Mail Removed)> wrote in message
news:bulhm3$88p$(E-Mail Removed)1.nb.home.nl...
> Thank you for your last comment
> I do not write a usercontrol since the source of a usercontrol can be
> editted by the user, its part of the project. Instead I want to write my

own
> Custom Servercontrol:
>
> a login dialog. My client gets a DLL which and he can use the custom

server
> controls on his html page.
>
> I hope you understand what I'm meaning
>
> Ton
>
>
> "Alessandro Zifiglio" <(E-Mail Removed)> schreef in
> bericht news:MNBNb.3597$(E-Mail Removed)...
> > All the basics for user control creating and usage are there on this
> > tutorial.
> >
> > http://docs.aspng.com/quickstart/asp...bpagelets.aspx
> >
> >
> > "ton" <(E-Mail Removed)> wrote in message
> > news:bu6f4r$mfi$(E-Mail Removed)1.nb.home.nl...
> > > I'm sorry I do not understand it.
> > > I can place these controls on the webform. But how can I call this

form,
> > > from what method or how look the code behind file to get a usercontrol

> (as
> > a
> > > DLL), which my customers could use.
> > >
> > > can you explain this in more detail, or can you give me a link where

> this
> > is
> > > explained
> > >
> > > Ton
> > >
> > > "Alessandro Zifiglio" <(E-Mail Removed)> schreef

> in
> > > bericht news:wOyNb.3548$(E-Mail Removed)...
> > > > code the markup tags in the .ascx file, its just like working on a

> > normal
> > > > aspx file with the exception that you cannot add <html><head><body>

> > tags,
> > > > shouldnt be very difficult. If you are using vs.net then use the

> > designer
> > > > and drag and drop controls into the page, couldnt get simpler
> > > >
> > > > "ton" <(E-Mail Removed)> wrote in message
> > > > news:bu6c7r$s3m$(E-Mail Removed)1.nb.home.nl...
> > > > > Hi,
> > > > > i want to create a server-site usercontrol to logon a database: It
> > > should
> > > > be
> > > > > very simple but i cannot get the label en textbox in the write

> order.
> > I
> > > > want
> > > > > domething like
> > > > >
> > > > > Name : [ tekstbox]
> > > > > Password [ tekstbox]
> > > > >
> > > > > Button
> > > > >
> > > > > as just one usercontrol
> > > > >
> > > > > can someone help me
> > > > >
> > > > > thanx
> > > > >
> > > > > Ton
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
ton
Guest
Posts: n/a
 
      01-22-2004
thank you very much, this works fine

ton
"Alessandro Zifiglio" <(E-Mail Removed)> schreef in
bericht news:4ytPb.5882$(E-Mail Removed)...
> hi Ton, the reason i said code the markup in your usercontrol is because

you
> explicitly stated that you wanted to control placement of Items in your
> "UserControl".
>
> Ok, if this is a custom web control, in your CreateChildControls method as
> you add your controls that is label + textboxes one of the simplest ways

to
> go about markup is to try adding them into a table control.
>
> Protected Overrides Sub CreateChildControls()
>
> Dim table As New table()
> table.ID = ClientID & "_table"
> Controls.Add(table)
>
> Dim r1 As New TableRow()
> Dim r2 As New TableRow()
> Dim c1 As New TableCell()
> Dim c2 As New TableCell()
> Dim c3 As New TableCell()
> Dim c4 As New TableCell()
>
> c1.controls.add(label1)
> c2.controls.add(textbox1)
> r1.cells.add(c1)
> r1.cells.add(c2)
>
> label1.id = clientID & "_lblusername"
> label1.text = "Username:"
> textbox1.id = clientID & "_txtusername"
>
>
> c3.controls.add(label2)
> c4.controls.add(textbox2)
> r2.cells.add(c3)
> r2.cells.add(c4)
>
> 'set properties after adding the control to the controls collection
> lable2.id = clientID & "_password"
> label2.text = "Password:"
> textbox1.id = clientID & "_txtpassword"
>
> 'now add your two rows to the table
> table.rows.add(r1)
> table.rows.add(r2)
>
> End sub
>
> this will give you the format :
>
> username : ----------
>
> password : ----------
>
> You can further set fixed styling to the table or expose style as a

property
> of your control that way you can set it from the properties grid just like
> with any web control.
>
> "ton" <(E-Mail Removed)> wrote in message
> news:bulhm3$88p$(E-Mail Removed)1.nb.home.nl...
> > Thank you for your last comment
> > I do not write a usercontrol since the source of a usercontrol can be
> > editted by the user, its part of the project. Instead I want to write my

> own
> > Custom Servercontrol:
> >
> > a login dialog. My client gets a DLL which and he can use the custom

> server
> > controls on his html page.
> >
> > I hope you understand what I'm meaning
> >
> > Ton
> >
> >
> > "Alessandro Zifiglio" <(E-Mail Removed)> schreef

in
> > bericht news:MNBNb.3597$(E-Mail Removed)...
> > > All the basics for user control creating and usage are there on this
> > > tutorial.
> > >
> > > http://docs.aspng.com/quickstart/asp...bpagelets.aspx
> > >
> > >
> > > "ton" <(E-Mail Removed)> wrote in message
> > > news:bu6f4r$mfi$(E-Mail Removed)1.nb.home.nl...
> > > > I'm sorry I do not understand it.
> > > > I can place these controls on the webform. But how can I call this

> form,
> > > > from what method or how look the code behind file to get a

usercontrol
> > (as
> > > a
> > > > DLL), which my customers could use.
> > > >
> > > > can you explain this in more detail, or can you give me a link where

> > this
> > > is
> > > > explained
> > > >
> > > > Ton
> > > >
> > > > "Alessandro Zifiglio" <(E-Mail Removed)>

schreef
> > in
> > > > bericht news:wOyNb.3548$(E-Mail Removed)...
> > > > > code the markup tags in the .ascx file, its just like working on a
> > > normal
> > > > > aspx file with the exception that you cannot add

<html><head><body>
> > > tags,
> > > > > shouldnt be very difficult. If you are using vs.net then use the
> > > designer
> > > > > and drag and drop controls into the page, couldnt get simpler
> > > > >
> > > > > "ton" <(E-Mail Removed)> wrote in message
> > > > > news:bu6c7r$s3m$(E-Mail Removed)1.nb.home.nl...
> > > > > > Hi,
> > > > > > i want to create a server-site usercontrol to logon a database:

It
> > > > should
> > > > > be
> > > > > > very simple but i cannot get the label en textbox in the write

> > order.
> > > I
> > > > > want
> > > > > > domething like
> > > > > >
> > > > > > Name : [ tekstbox]
> > > > > > Password [ tekstbox]
> > > > > >
> > > > > > Button
> > > > > >
> > > > > > as just one usercontrol
> > > > > >
> > > > > > can someone help me
> > > > > >
> > > > > > thanx
> > > > > >
> > > > > > Ton
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      01-22-2004
your welcome ton
"ton" <(E-Mail Removed)> wrote in message
news:buofqi$564$(E-Mail Removed)1.nb.home.nl...
> thank you very much, this works fine
>
> ton
> "Alessandro Zifiglio" <(E-Mail Removed)> schreef in
> bericht news:4ytPb.5882$(E-Mail Removed)...
> > hi Ton, the reason i said code the markup in your usercontrol is because

> you
> > explicitly stated that you wanted to control placement of Items in your
> > "UserControl".
> >
> > Ok, if this is a custom web control, in your CreateChildControls method

as
> > you add your controls that is label + textboxes one of the simplest ways

> to
> > go about markup is to try adding them into a table control.
> >
> > Protected Overrides Sub CreateChildControls()
> >
> > Dim table As New table()
> > table.ID = ClientID & "_table"
> > Controls.Add(table)
> >
> > Dim r1 As New TableRow()
> > Dim r2 As New TableRow()
> > Dim c1 As New TableCell()
> > Dim c2 As New TableCell()
> > Dim c3 As New TableCell()
> > Dim c4 As New TableCell()
> >
> > c1.controls.add(label1)
> > c2.controls.add(textbox1)
> > r1.cells.add(c1)
> > r1.cells.add(c2)
> >
> > label1.id = clientID & "_lblusername"
> > label1.text = "Username:"
> > textbox1.id = clientID & "_txtusername"
> >
> >
> > c3.controls.add(label2)
> > c4.controls.add(textbox2)
> > r2.cells.add(c3)
> > r2.cells.add(c4)
> >
> > 'set properties after adding the control to the controls collection
> > lable2.id = clientID & "_password"
> > label2.text = "Password:"
> > textbox1.id = clientID & "_txtpassword"
> >
> > 'now add your two rows to the table
> > table.rows.add(r1)
> > table.rows.add(r2)
> >
> > End sub
> >
> > this will give you the format :
> >
> > username : ----------
> >
> > password : ----------
> >
> > You can further set fixed styling to the table or expose style as a

> property
> > of your control that way you can set it from the properties grid just

like
> > with any web control.
> >
> > "ton" <(E-Mail Removed)> wrote in message
> > news:bulhm3$88p$(E-Mail Removed)1.nb.home.nl...
> > > Thank you for your last comment
> > > I do not write a usercontrol since the source of a usercontrol can be
> > > editted by the user, its part of the project. Instead I want to write

my
> > own
> > > Custom Servercontrol:
> > >
> > > a login dialog. My client gets a DLL which and he can use the custom

> > server
> > > controls on his html page.
> > >
> > > I hope you understand what I'm meaning
> > >
> > > Ton
> > >
> > >
> > > "Alessandro Zifiglio" <(E-Mail Removed)> schreef

> in
> > > bericht news:MNBNb.3597$(E-Mail Removed)...
> > > > All the basics for user control creating and usage are there on this
> > > > tutorial.
> > > >
> > > > http://docs.aspng.com/quickstart/asp...bpagelets.aspx
> > > >
> > > >
> > > > "ton" <(E-Mail Removed)> wrote in message
> > > > news:bu6f4r$mfi$(E-Mail Removed)1.nb.home.nl...
> > > > > I'm sorry I do not understand it.
> > > > > I can place these controls on the webform. But how can I call this

> > form,
> > > > > from what method or how look the code behind file to get a

> usercontrol
> > > (as
> > > > a
> > > > > DLL), which my customers could use.
> > > > >
> > > > > can you explain this in more detail, or can you give me a link

where
> > > this
> > > > is
> > > > > explained
> > > > >
> > > > > Ton
> > > > >
> > > > > "Alessandro Zifiglio" <(E-Mail Removed)>

> schreef
> > > in
> > > > > bericht news:wOyNb.3548$(E-Mail Removed)...
> > > > > > code the markup tags in the .ascx file, its just like working on

a
> > > > normal
> > > > > > aspx file with the exception that you cannot add

> <html><head><body>
> > > > tags,
> > > > > > shouldnt be very difficult. If you are using vs.net then use the
> > > > designer
> > > > > > and drag and drop controls into the page, couldnt get simpler


> > > > > >
> > > > > > "ton" <(E-Mail Removed)> wrote in message
> > > > > > news:bu6c7r$s3m$(E-Mail Removed)1.nb.home.nl...
> > > > > > > Hi,
> > > > > > > i want to create a server-site usercontrol to logon a

database:
> It
> > > > > should
> > > > > > be
> > > > > > > very simple but i cannot get the label en textbox in the write
> > > order.
> > > > I
> > > > > > want
> > > > > > > domething like
> > > > > > >
> > > > > > > Name : [ tekstbox]
> > > > > > > Password [ tekstbox]
> > > > > > >
> > > > > > > Button
> > > > > > >
> > > > > > > as just one usercontrol
> > > > > > >
> > > > > > > can someone help me
> > > > > > >
> > > > > > > thanx
> > > > > > >
> > > > > > > Ton
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Positioning a dynamic user control? Tarun Mistry ASP .Net 2 09-27-2006 06:59 PM
Web User Control - positioning on the page Eric ASP .Net 1 07-23-2006 11:00 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
User control - lacking positioning on page ken bus ASP .Net Building Controls 0 11-25-2004 04:25 AM



Advertisments