473,406 Members | 2,710 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,406 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 1323
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.