473,324 Members | 2,268 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,324 software developers and data experts.

Any idea for Creating controls according to configuration?

Hello,guys!

I need some idea for Creating controls accoring to configuration.

The context.

Some controls are configured by xml, and there's also some xml string
to configure the layout of all the layout.It could be simple,just a
html table,and make it possible to layout controls by a table grid.

But a more wonderful one is expected to be possible:configure the
layout with plain html including images,links,div and so on,and the
controls are just laid in it by id.
I'm not sure how to implement it.Maybe the layout configure could be a
ascx-content like,then the code could loadTemplate dynamic,but how to
replace or add the controls?Of course, a step by step,element by
element parsing solution could be more adaptable,that surely has lots
of tag to manage.

I'd like hear you ideas,thanks!

btw,is it possible to loadTemplate dynamicly from string,but not from
virtualPath? thanks!

Jul 21 '05 #1
5 1321
Rhet,

I assume it is a webform

See this sample I made (and changed a little bit today)

\\\Needs a panel on the page where the name panel is deleted
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim mybutton As Button
Dim i As Integer
For i = 0 To New Date().DaysInMonth _
(New Date().Year, New Date().Month) - 1
mybutton = New Button
mybutton.BackColor = Drawing.Color.White
mybutton.Text = (i + 1).ToString
mybutton.Width = New Unit(30)
Me.Panel1.Controls.Add(mybutton)
AddHandler mybutton.Click, AddressOf mybutton_Click
If (i + 1) Mod 5 = 0 Then
Me.Panel1.Controls.Add(New LiteralControl("<BR>"))
End If
Next
End Sub
Private Sub mybutton_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim mylabel As New Label
Me.Panel1.Controls.Add(New LiteralControl("<BR><BR>"))
Me.Panel1.Controls.Add(mylabel)
mylabel.Text = "The day is: " & DirectCast(sender, Button).Text
End Sub
////

Link
http://msdn.microsoft.com/library/de...satruntime.asp

I hope this helps a little bit?

Cor
Jul 21 '05 #2
Hello Cor!

You may miss my point.

the most important is the layout,just think about a html table
organizing all the controls specified in controls config, but also
including other elements,like images, links that scriptted in the
layout config

Jul 21 '05 #3
Rhet,

You may miss my point.

the most important is the layout,just think about a html table
organizing all the controls specified in controls config, but also
including other elements,like images, links that scriptted in the
layout config


Did you look at the sample?

Have a look in the sample at
Me.Panel1.Controls.Add(New LiteralControl("<BR>"))

Cor
Jul 21 '05 #4
I mean the layout is configured like below

<table>
<tr>
<td controlid='ctrl1'></td><td controlid='ctrl2'></td>
</tr>
<tr>
<td colspan='2'><img src='img1.gif'></img></td>
</tr>
</table>
all the layout is configured like above, more elements like '<div>'
'<a>',which will render much wonderful UI.
The important is the layout is configured by script,not by code.

Jul 21 '05 #5
Rhett,

I did not try however when it was my problem I would try something as I
showed however now in even more code.

\\\
setLit("<table>")
setLit("<tr>")
etc
///
\\\
Private Sub setLit(byval Lit as string)
Me.Panel1.Controls.Add(New LiteralControl(Lit))
End sub
///

I hope this helps

Copr
Jul 21 '05 #6

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

Similar topics

19
by: Steve | last post by:
Can anyone point me to a primer for creating OCX controls in VB .net? In particular, I want to access a web service in a VB6 application (not an easy thing to do). So, if I can write an ActiveX...
29
by: Jim Hubbard | last post by:
Yet another hotfix alert (http://www.kbalertz.com/Feedback_823535.aspx) that states "To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix." ...
4
by: Ron Vecchi | last post by:
Could someone point me in the right direction for creating a control similar to the VS solution explorer where it will auto hide and open when needed. Thanks -- Ron Vecchi
10
by: Nathan Sokalski | last post by:
I have a DataList control with an EditTemplate. Three of the controls in this template include a Calendar, a Button with CommandName="update", and a Button with CommandName="cancel". Whenever I...
5
by: Rhett | last post by:
Hello,guys! I need some idea for Creating controls accoring to configuration. The context. Some controls are configured by xml, and there's also some xml string to configure the layout of...
4
by: Henrik Dahl | last post by:
Hello! Is it possible to use Visual Studio 2005 or, secondarily, Visual Studio .NET 2003 to create ActiveX controls which may be consumed by VB 6.0 programs, i.e. dealt with on forms in the...
3
by: s9213037 | last post by:
Use case scenario: I have a panel with ID "Upload_Panel", where there is a FileUpload control with ID "FileUpload1" and a button with ID "More_Upload_Files", both of which are added at design...
8
by: BillE | last post by:
When I create a control dynamically and it grows according to the content, the control Height property still returns the original default control height instead of the height after expanding. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.