Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Setting Labels.Text DynamicallySetting Labels.Text Dynamically
Previous
 
Next
New Post
9/13/2006 5:16 PM
 

This used to work in asp1.1 but now doesn't seem to work.  I would like to create a gannt chart with labels (or objects) and position them based on data from an sql query. 

<div id="MyTop" style="position: relative; width: 800px; height: 300px; background-color: #9c6;">
<%
Dim it As Integer = 1
Dim x As String = CStr(it)
Dim y As String = CStr(40)
Dim z As String
For it = 5 To 23
x =
CStr(it * 10)
y =
CStr(10 * (it - 5))
z =
"MyText"
%>
<div style="position:absolute; top:<% =y %>px; left:<% =x %>px;" >
<asp:Label runat="server" Text= '<% =z %>' Width="50px" BorderStyle="Solid"></asp:Label>
</div>
<% Next %>
</div>

Why can't I fill the label text?  Text= '<% =z %>'     This is what the asp:Label line looks like

<span style="border-style:Solid;width:50px;"><% =z %></span>

How could I fill and change the features of label?

Thank you.

 
New Post
9/14/2006 8:49 AM
 

while I don't claim to be an expert at asp.net I think the answer lies in the runat="server".  I would explain it that label control get's it's HTML written from being run on the server and the render block never get's a chance.  This is a bit differet than classic asp. 

 One of the real nice features of asp.net is codebehind.   You can separate the code from the display.  I would say the "right" way to do this would be to give your label an ID in the aspx file like 

 
<asp:Label runat="server" id="myLabel" Width="50px" BorderStyle="Solid"></asp:Label>

and then in the codehind page_load event you would set the text property like

me.myLabel.Text=z

Then the code that set the value of z would be in the same place as it code that displays the value.   if you worked much with classic asp then you will know that all that code mixed with html can get a little hard to understand and once you get in the right mindset of the codebehind model makes sense and is much better.

my 2 cents

mj

 


Michael Jackson
Brillnat.com
Custom module development
Database access tokenized HTML modules
 
New Post
9/14/2006 12:00 PM
 

Thanks Michael,

Since the post I have put it into the code behind - where it works fine. Just positioning the object causes trouble.  I've tried to put it in a panel which collects them all.  The real goal is to define an area (a panel) and then place the label or object relative to the top/left of the panel. 

What I'm trying to do, is create a gantt like chart with labels - which in the future I would also like to move around (grab and drop).

Anyone with any ideas of correct positioning of an object in a panel/container?

Thank you

Karl

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Setting Labels.Text DynamicallySetting Labels.Text Dynamically


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out