"André" <hjhhb@ddwrote in message
news:eK**************@TK2MSFTNGP04.phx.gbl...
This part works great, but what i would like to do is beside each table,
create a little 2-D bitmap graphic representing the frequenties. So to my
knowledge (and according others experts in this group), that bitmap
graphic must be created in another page and called from the first page.
This also works great (with one table and one graphic), except when there
are a lot of graphics to make (one per question).
Well, I don't know who told you that - there is absolutely no need to use
two pages for this.
So, please Mark, don't think i'm a fool who can nearly read or something.
I have a actual problem: how to get those bitmap graphics beside each
table into page 1? Is this problem so weird, so stupid or ridiculus? Not
to me anyway.
Don't shoot the messenger, mate... The problem isn't weird, stupid or
ridiculous - you've obviously been given bad advice.
I would very much appreciate if you could help me.
Here's a quick and dirty page I knocked up in about five minutes - no need
for messing about with bitmap graphics or whatever...
I hope this is the sort of thing you're looking for (code is below).
Obviously, I have hard-coded the data and you will be fetching it from a
database, but the concept is the same.
http://www.markrae.com/zzScratch/TestBars.aspx
About the cookie, i agree with you. I hope you noticed I tried another
solution with sending a parameter. But that doesn't work, so i try
something else with cookies. Is there more, better solutions? Tell me
then. Please
Are you not, then, fetching the data from a database? In which case, you
don't actually need to pass anything anywhere - just read it when you need
it...
However, in ASP.NET if you need to persist data across more than one page,
you have several choices:
1) you can append the data to the target URL in a querystring e.g.
test.aspx?id=1&value=2
2) you can use the Session object to store the value(s)
3) in ASP.NET 2, you can post from one page to another
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestBars.aspx.cs"
Inherits="zzScratch_TestBars" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Dynamically sized graphics</title>
</head>
<body>
<form id="form1" runat="server">
Change the values in the boxes and click here <asp:Button ID="cmdRedraw"
runat="server" Text="Redraw" OnClick="cmdRedraw_Click" /><br />
<br />
<asp:Table ID="tblBars" runat="server">
<asp:TableHeaderRow>
<asp:TableHeaderCell Text="Value" HorizontalAlign="Left" />
<asp:TableHeaderCell Text="Frequency" HorizontalAlign="Left" />
<asp:TableHeaderCell Text="Graphic" HorizontalAlign="Left" />
</asp:TableHeaderRow>
<asp:TableRow>
<asp:TableCell Text="1" />
<asp:TableCell><asp:TextBox runat="server" Text="6" Width="20px"
MaxLength="2" /></asp:TableCell>
<asp:TableCell><asp:Label runat="server" BackColor="Red" Width="60px"
/></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="2" />
<asp:TableCell><asp:TextBox runat="server" Text="3" Width="20px"
MaxLength="2" /></asp:TableCell>
<asp:TableCell><asp:Label runat="server" BackColor="Red" Width="30px"
/></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="3" />
<asp:TableCell><asp:TextBox runat="server" Text="32" Width="20px"
MaxLength="2" /></asp:TableCell>
<asp:TableCell><asp:Label runat="server" BackColor="Red" Width="320px"
/></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="4" />
<asp:TableCell><asp:TextBox runat="server" Text="26" Width="20px"
MaxLength="2" /></asp:TableCell>
<asp:TableCell><asp:Label runat="server" BackColor="Red" Width="260px"
/></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="5" />
<asp:TableCell><asp:TextBox runat="server" Text="12" Width="20px"
MaxLength="2" /></asp:TableCell>
<asp:TableCell><asp:Label runat="server" BackColor="Red" Width="120px"
/></asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>
using System;
using System.Web.UI.WebControls;
public partial class zzScratch_TestBars : System.Web.UI.Page
{
protected void cmdRedraw_Click(object sender, EventArgs e)
{
foreach (TableRow objTR in tblBars.Rows)
{
if (objTR.GetType().Name == "TableRow")
{
((Label)objTR.Cells[2].Controls[0]).Width =
Unit.Pixel(Convert.ToInt32(((TextBox)objTR.Cells[1].Controls[0]).Text) *
10);
}
}
}
}