PC Review


Reply
Thread Tools Rate Thread

Any idea for Creating controls according to configuration?

 
 
Rhett
Guest
Posts: n/a
 
      1st Mar 2005
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!

 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      1st Mar 2005
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


 
Reply With Quote
 
Rhett
Guest
Posts: n/a
 
      2nd Mar 2005
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

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      2nd Mar 2005
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


 
Reply With Quote
 
Rhett
Guest
Posts: n/a
 
      3rd Mar 2005
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.

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      3rd Mar 2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
configuration error (website using Telerik Rad controls) Cirene Microsoft ASP .NET 3 23rd May 2008 03:23 PM
creating dynamic controls out of static controls Tarscher Microsoft ASP .NET 9 13th Feb 2007 02:33 PM
Dynamically changing controls... a bad idea? margaret_alice@eml.cc Microsoft ASP .NET 0 10th May 2006 02:35 AM
Creating Custom Controls but Not User Controls. =?Utf-8?B?SmFp?= Microsoft Dot NET 0 3rd Oct 2005 06:21 AM
Is windowless controls in windows a feasible idea =?Utf-8?B?TWFoYW50ZXNo?= Microsoft Dot NET Framework Forms 2 24th Mar 2004 11:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:52 PM.