|
-
Aug 29th, 2006, 07:03 AM
#1
Thread Starter
New Member
[RESOLVED] [2005] Express How do I implement Top and Left in a user control
Total newbie at dot net dabbler at VB6 attempting to get to grips with VWD express.
I have designed a user control (basically a table containing 24 buttons in cells)
When I use this control I need to be able to set the Top and Left properties of the table from the calling page.
To get the value into the usercontrol I think I should use (Top only - Left would be the same):-
VB Code:
Public Property ControlTop() As Integer
Get
Return iControlTop
End Get
Set(ByVal value As Integer)
iControlTop = value
End Set
End Property
and then use ControlTop variable within the style section of the table definition :-
HTML Code:
<table style="z-index: 100; width: 600px; height: 45px">
<tr>
<td style="width: 4%" >
<asp:Button ID="Button1" runat="server" Style="z-index: 100" Text="01" OnClick="HButton_Click" />
</td>
<td style="width: 4%">
<asp:Button ID="Button2" runat="server" Style="z-index: 100" Text="02" OnClick="HButton_Click" />
could someone please point out the obvious and tell me how it should be done.
The above 'exposes' ControlTop' but I would much prefer to expose 'Top' correctly but this gives me problems as well, a solution for both would be excelent.
I have tried many things but cannot get anything to work - probably my total lack of HTML knowledge 
Thanks in advance
-
Aug 29th, 2006, 07:46 AM
#2
Thread Starter
New Member
Re: [2005] Express How do I implement Top and Left in a user control
OK, investigating somthing else and I've now got
HTML Code:
<table style="z-index: 100; width: 600px; height: 45px top: <%= iTop %>px left <%=iLeft %>px" >
and
VB Code:
Microsoft.VisualBasic.Left
to qualify the left that was giving the other problem but now the problem of attempting to use
HTML Code:
<uc1:HourControl ID="Hours1" runat="server" style="top: 10px left: 10px"/>
Gives me the error
Validation (ASP.Net): Attribute 'style' is not a valid attribute of element 'HourControl'.
-
Aug 29th, 2006, 10:35 AM
#3
Re: [2005] Express How do I implement Top and Left in a user control
In your codebehind,
Code:
this.Hourse1.Attributes.Add("style","left:" + this.MyLeftProperty + ";top:" + this.MyTopProperty);
-
Aug 30th, 2006, 01:58 AM
#4
Thread Starter
New Member
Re: [2005] Express How do I implement Top and Left in a user control
Thanks for this but unfortunatly it doesn't mean a lot to me. The ; would indicate java or c (from conversation arround my desk) but as the script I am using is VB sorry now Im lost.
Where does the (VB equivelent) above line go ? I assume into the codebehind for the usercontrol (to 'add' the 'style' and its attributes).
I do not comprehend the use if 'this' - is it the name of the usercontrol ? but how is this declared?
Sorry to ask for further help distinctly biased towards the group of 'idiot user grade' in which I am firmly entrenched :-(
-
Aug 30th, 2006, 11:38 AM
#5
Re: [2005] Express How do I implement Top and Left in a user control
Not very different in VB.NET.
In C#, you use 'this', in VB.NET, you say Me. this/Me refers to the current instance of the class. So:
VB Code:
Me.Hourse1.Attributes.Add("style","left:" + this.MyLeftProperty + ";top:" + this.MyTopProperty)
-
Aug 31st, 2006, 03:34 AM
#6
Thread Starter
New Member
Re: [2005] Express How do I implement Top and Left in a user control [Resolved]
-
Aug 31st, 2006, 10:04 AM
#7
Re: [RESOLVED] [2005] Express How do I implement Top and Left in a user control
Welcome.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|