Showing posts with label contains. Show all posts
Showing posts with label contains. Show all posts

Saturday, March 31, 2012

set a file upload control to a data column within a formview edit item template

I have a formview with an edit template which contains a textbox which has "ProductImageUrl" data column bound to it. I want to bind this to a fileupload control instead so that an image can be selected. There is no text field for a fileupload control.

Any ideas?

Thanks

Andrew

Hi, Andrew

Do you want to get the full path of the image? If so, you can use <input id="file1" type="file" ...> then you can get the full path using fil1.value.

Hope this helps.


Is there a way of just getting the file name and not the full path. Can you give me an example of the code behind for using the fil1.value bit.

Thanks

Andrew


Hello

If you want filename, not the full path, you can useFileUpload control and FileUpload1.FileName is that you want.

As to the code, it's very easy.

<%@. Page Language="C#" AutoEventWireup="True" %>

<script runat="server">

void Button1_Click(object Source, EventArgs e)
{

if (Text1.Value == "")
{
Span1.InnerHtml = "Error: You must enter a file name." + File1.Value;
return;
}

if (File1.PostedFile.ContentLength > 0)
{
try
{
File1.PostedFile.SaveAs("c:\\temp\\" + Text1.Value);
Span1.InnerHtml = "File uploaded successfully to <b>c:\\temp\\" +
Text1.Value + "</b> on the Web server.";
}
catch (Exception exc)
{
Span1.InnerHtml = "Error saving file <b>c:\\temp\\" +
Text1.Value + "</b><br>" + exc.ToString() + ".";


}
}

}
void Click(Object src, EventArgs s)
{
Span1.InnerHtml = File1.Value;
}
</script>

<html>
<head>
<title>HtmlInputFile Example</title>
</head>
<body>

<h3>HtmlInputFile Example</h3>

<form id="Form1" enctype="multipart/form-data"
runat="server">

Select File to Upload:
<input id="File1"
type="file" onselect="Click"
runat="server">

<p>
Save as file name (no path):
<input id="Text1"
type="text"
runat="server">

</p>
<p>
<span id=Span1
style="font: 8pt verdana;"
runat="server" />

</p>
<p>
<input type=button
id="Button1"
value="Upload"
onserverclick="Button1_Click"
runat="server">

</p>

</form>

</body>
</html>

Just click "browser" and then click "upload", the "span" will show the File1.Value.


You can get the file name with the following code

<input type="File" runat="server" ID="InputFile" />

To get the file name use the below line

InputFile.PostedFile.FileName


to get only the filename in a fullpath use

System.IO.Path.GetFileName(fullpath)

HC


The difficult part is that the textbox3 and fileupload controls are within a loginview and a detailsview so doing the findcontrol bit is twisting my melon considerably at the moment.

Any help gratefully received.

Thanks

Andrew


Here is my code

<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate></LoggedInTemplate>
<AnonymousTemplate>
You need to be logged in and be an Administrator to see this page.
</AnonymousTemplate>
<RoleGroups>
<asp:RoleGroup roles="Administrator">
<ContentTemplate>
<h3>Click Edit to view and edit product details and description</h3>
<asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False" DataSourceID="ObjectDataSource1" Height="50px" Width="100%" DataKeyNames="ProductItemID" AutoGenerateEditButton="True" AutoGenerateInsertButton="True" AutoGenerateDeleteButton="True" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal" OnPageIndexChanging="DetailsView1_PageIndexChanging">
<Fields>
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
<asp:BoundField DataField="ProductDescription" HeaderText="ProductDescription" SortExpression="ProductDescription" Visible="False" />
<asp:BoundField DataField="ProductPrice" HeaderText="ProductPrice" SortExpression="ProductPrice" />
<asp:TemplateField HeaderText="ProductImageUrl" SortExpression="ProductImageUrl">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("ProductImageUrl") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("ProductImageUrl") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("ProductImageUrl") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ProductCategoryID" SortExpression="ProductCategoryID">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ProductCategoryID") %>'></asp:TextBox>
cat id<br /> </EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ProductCategoryID") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("ProductCategoryID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>
<FTB:FreeTextBox id="ProductDescriptionTextBox" runat="server" Text='<%# Bind("ProductDescription") %>'>
</FTB:FreeTextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>

</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("ProductItemID") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<img src="http://pics.10026.com/?src=images/<%# Eval("ProductImageUrl") %>" style="width:100px;" />

</ItemTemplate>
</asp:TemplateField>
</Fields>
<EmptyDataTemplate>
<strong>Product successfully deleted</strong>
</EmptyDataTemplate>
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:DetailsView>
<br />
<br />
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/editproducts.aspx">Go back to edit products</asp:HyperLink><br />
<br />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="{0}"
SelectMethod="GetDataByProductItemID" TypeName="DataSet3TableAdapters.DataTable1TableAdapter" UpdateMethod="UpdateQuery" InsertMethod="InsertQuery" DeleteMethod="DeleteQuery">
<SelectParameters>
<asp:QueryStringParameter Name="ProductItemID" QueryStringField="ProductItemID" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ProductName" Type="String" />
<asp:Parameter Name="ProductDescription" Type="String" />
<asp:Parameter Name="ProductPrice" Type="Int32" />
<asp:Parameter Name="ProductImageUrl" Type="String" />
<asp:Parameter Name="WebsiteCategoryID" Type="Int32" />
<asp:Parameter Name="ProductCategoryID" Type="Int32" />
<asp:Parameter Name="ProductItemID" Type="Int32" />

</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ProductCategoryID" Type="Int32" />
<asp:Parameter Name="ProductName" Type="String" />
<asp:Parameter Name="ProductDescription" Type="String" />
<asp:Parameter Name="ProductImageUrl" Type="String" />
<asp:Parameter Name="WebsiteCategoryID" Type="Int32" />
<asp:Parameter Name="ProductPrice" Type="Int32" />
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="ProductItemID" Type="Int32" />

</DeleteParameters>
</asp:ObjectDataSource>
<br />
<br />
<br />
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>


</asp:LoginView>

Set Background Color Using Column Value?

Very newbie question and I hope this is the right group. I have a
table on a web page which contains info about paint colors. One column
contains the hex value for the color's RGB value. I want to display
info from the table in a grid or table and use the column value from
the RGBHex column to set each row's back ground color. I can just
about do this in my sleep in old style ASP using <%%> tags but I would
like to implement it in .NET 2. My website has this implemented in
old ASP here: www.paintmatcher.com/tool/tool.asp Any help is greatly
appreciated.On Mar 17, 1:26 pm, "TF" <TJForw...@.gmail.com> wrote:
> the RGBHex column to set each row's back ground color. I can just
> about do this in my sleep in old style ASP using <%%> tags
it could be the same as in ASP 3:
bgcolor="#<%=hex_value%>"
where "hex_value" is a variable
Here's a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>
Could I use ASP 3 <%%> tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there's a better solution than using a GridView. Any other
ideas?
Thanks.
Alexey Smirnov wrote:
> On Mar 17, 1:26 pm, "TF" <TJForw...@.gmail.com> wrote:
> it could be the same as in ASP 3:
> bgcolor="#<%=hex_value%>"
> where "hex_value" is a variable
More see here!
http://www.flash50.com/index.php
On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.com> wrote:
> Here's a snippet of the code created by MS Vis Web Developer 05
> Express. The data from the table displays just fine. I want to set
> the back color of each row based on the value of the "RGBHex" field.
> <asp:GridView ID="GridView1" runat="server" AllowSorting="True"
> AutoGenerateColumns="False"
> DataKeyNames="ID" DataSourceID="AccessDataSource2"
> EmptyDataText="There are no data records to
> display.">
> <Columns>
> <asp:BoundField DataField="ID" HeaderText="ID"
> ReadOnly="True" SortExpression="ID" />
> <asp:BoundField DataField="Brand" HeaderText="Brand"
> SortExpression="Brand" />
> <asp:BoundField DataField="Colorname"
> HeaderText="Colorname" SortExpression="Colorname" />
> <asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
> SortExpression="RGBValue" />
> <asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
> SortExpression="RGBHex" />
> </Columns>
> </asp:GridView>
> Could I use ASP 3 <%%> tags inside the BoundField tag? How would I
> call the field value using ASP.NET to assign to the variable? Or
> maybe there's a better solution than using a GridView. Any other
> ideas?
>
In this case you should rewrite a GridView_RowDataBound event.
Change <asp:GridView ID="GridView1"
OnRowDataBound="GridView1_RowDataBound"...
and add the GridView1_RowDataBound event to your code (code-behind)
C#:
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
}
}
I didn't test it but it should work, I think
On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.com> wrote:
> On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.com> wrote:
>
>
>
>
> In this case you should rewrite a GridView_RowDataBound event.
> Change <asp:GridView ID="GridView1"
> OnRowDataBound="GridView1_RowDataBound"...
> and add the GridView1_RowDataBound event to your code (code-behind)
> C#:
> protected void GridView1_RowDataBound(object sender,
> GridViewRowEventArgs e)
> {
> if (e.Row.RowType == DataControlRowType.DataRow)
> {
> string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
> e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
> }
> }
> I didn't test it but it should work, I think
OK. Where do I put that C# code snippet?
On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.com> wrote:
> On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.com> wrote:
>
>
>
>
> In this case you should rewrite a GridView_RowDataBound event.
> Change <asp:GridView ID="GridView1"
> OnRowDataBound="GridView1_RowDataBound"...
> and add the GridView1_RowDataBound event to your code (code-behind)
> C#:
> protected void GridView1_RowDataBound(object sender,
> GridViewRowEventArgs e)
> {
> if (e.Row.RowType == DataControlRowType.DataRow)
> {
> string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
> e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
> }
> }
> I didn't test it but it should work, I think
OK. Where do I put that C# code snippet?
On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.com> wrote:
> On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.com> wrote:
>
>
>
>
> In this case you should rewrite a GridView_RowDataBound event.
> Change <asp:GridView ID="GridView1"
> OnRowDataBound="GridView1_RowDataBound"...
> and add the GridView1_RowDataBound event to your code (code-behind)
> C#:
> protected void GridView1_RowDataBound(object sender,
> GridViewRowEventArgs e)
> {
> if (e.Row.RowType == DataControlRowType.DataRow)
> {
> string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
> e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
> }
> }
> I didn't test it but it should work, I think
OK. Where do I put that C# code snippet?
On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.com> wrote:
> On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.com> wrote:
>
>
>
>
> In this case you should rewrite a GridView_RowDataBound event.
> Change <asp:GridView ID="GridView1"
> OnRowDataBound="GridView1_RowDataBound"...
> and add the GridView1_RowDataBound event to your code (code-behind)
> C#:
> protected void GridView1_RowDataBound(object sender,
> GridViewRowEventArgs e)
> {
> if (e.Row.RowType == DataControlRowType.DataRow)
> {
> string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
> e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
> }
> }
> I didn't test it but it should work, I think
OK. I may be getting this now. I made this the first line of my
default.aspx.
<%@. Page Language="C#" AutoEventWireup="false"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
And this is the contents of the default.aspx.cs file. Renamed my grid
GridView2 by the way.
protected void GridView2_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"];
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
}
}
Getting these compilation errors.
c:\...Default.aspx.cs(1,11): error CS1518: Expected class, delegate,
enum, interface, or struct
c:\...Default.aspx.cs(6,27): error CS1001: Identifier expected
c:\...Default.aspx.cs(9,1): error CS1022: Type or namespace
definition, or end-of-file expected
I feel like I'm getting close but I just can't get it. Thank you for
your help.
TF
On Mar 18, 9:24 pm, "TF" <TJForw...@.gmail.com> wrote:
> On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> OK. I may be getting this now. I made this the first line of my
> default.aspx.
> <%@. Page Language="C#" AutoEventWireup="false"
> CodeFile="Default.aspx.cs" Inherits="_Default" %>
> And this is the contents of the default.aspx.cs file. Renamed my grid
> GridView2 by the way.
> protected void GridView2_RowDataBound(object sender,
> GridViewRowEventArgs e)
> {
> if (e.Row.RowType == DataControlRowType.DataRow)
> {
> string c = e.Row.DataItem["RGBHex"];
> e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
> }
> }
> Getting these compilation errors.
> c:\...Default.aspx.cs(1,11): error CS1518: Expected class, delegate,
> enum, interface, or struct
> c:\...Default.aspx.cs(6,27): error CS1001: Identifier expected
> c:\...Default.aspx.cs(9,1): error CS1022: Type or namespace
> definition, or end-of-file expected
> I feel like I'm getting close but I just can't get it. Thank you for
> your help.
> TF- Hide quoted text -
> - Show quoted text -
Mate, you have to start from the basic.
It told you that you miss a class, that is you have to define the
_Default
Remember, you said <%@. Page ... Inherits="_Default"
<!-- This is the name of your class
So, the code-behind should be like this:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
..............code here...............
}

Set Background Color Using Column Value?

Very newbie question and I hope this is the right group. I have a
table on a web page which contains info about paint colors. One column
contains the hex value for the color's RGB value. I want to display
info from the table in a grid or table and use the column value from
the RGBHex column to set each row's back ground color. I can just
about do this in my sleep in old style ASP using <%%tags but I would
like to implement it in .NET 2. My website has this implemented in
old ASP here: www.paintmatcher.com/tool/tool.asp Any help is greatly
appreciated.On Mar 17, 1:26 pm, "TF" <TJForw...@.gmail.comwrote:

Quote:

Originally Posted by

the RGBHex column to set each row's back ground color. I can just
about do this in my sleep in old style ASP using <%%tags


it could be the same as in ASP 3:

bgcolor="#<%=hex_value%>"

where "hex_value" is a variable
Here's a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.

<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>

Could I use ASP 3 <%%tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there's a better solution than using a GridView. Any other
ideas?

Thanks.

Alexey Smirnov wrote:

Quote:

Originally Posted by

On Mar 17, 1:26 pm, "TF" <TJForw...@.gmail.comwrote:

Quote:

Originally Posted by

the RGBHex column to set each row's back ground color. I can just
about do this in my sleep in old style ASP using <%%tags


>
it could be the same as in ASP 3:
>
bgcolor="#<%=hex_value%>"
>
where "hex_value" is a variable


More see here!

http://www.flash50.com/index.php
On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.comwrote:

Quote:

Originally Posted by

Here's a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.
>
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>
>
Could I use ASP 3 <%%tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there's a better solution than using a GridView. Any other
ideas?
>


In this case you should rewrite a GridView_RowDataBound event.

Change <asp:GridView ID="GridView1"
OnRowDataBound="GridView1_RowDataBound"...

and add the GridView1_RowDataBound event to your code (code-behind)

C#:

protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
}

}

I didn't test it but it should work, I think
On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.comwrote:

Quote:

Originally Posted by

On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.comwrote:
>
>
>

Quote:

Originally Posted by

Here's a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.


>

Quote:

Originally Posted by

<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>


>

Quote:

Originally Posted by

Could I use ASP 3 <%%tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there's a better solution than using a GridView. Any other
ideas?


>
In this case you should rewrite a GridView_RowDataBound event.
>
Change <asp:GridView ID="GridView1"
OnRowDataBound="GridView1_RowDataBound"...
>
and add the GridView1_RowDataBound event to your code (code-behind)
>
C#:
>
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
>
if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
>
}
}
>
I didn't test it but it should work, I think


OK. Where do I put that C# code snippet?
On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.comwrote:

Quote:

Originally Posted by

On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.comwrote:
>
>
>

Quote:

Originally Posted by

Here's a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.


>

Quote:

Originally Posted by

<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>


>

Quote:

Originally Posted by

Could I use ASP 3 <%%tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there's a better solution than using a GridView. Any other
ideas?


>
In this case you should rewrite a GridView_RowDataBound event.
>
Change <asp:GridView ID="GridView1"
OnRowDataBound="GridView1_RowDataBound"...
>
and add the GridView1_RowDataBound event to your code (code-behind)
>
C#:
>
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
>
if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
>
}
}
>
I didn't test it but it should work, I think


OK. Where do I put that C# code snippet?
On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.comwrote:

Quote:

Originally Posted by

On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.comwrote:
>
>
>

Quote:

Originally Posted by

Here's a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.


>

Quote:

Originally Posted by

<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>


>

Quote:

Originally Posted by

Could I use ASP 3 <%%tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there's a better solution than using a GridView. Any other
ideas?


>
In this case you should rewrite a GridView_RowDataBound event.
>
Change <asp:GridView ID="GridView1"
OnRowDataBound="GridView1_RowDataBound"...
>
and add the GridView1_RowDataBound event to your code (code-behind)
>
C#:
>
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
>
if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
>
}
}
>
I didn't test it but it should work, I think


OK. Where do I put that C# code snippet?
On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.comwrote:

Quote:

Originally Posted by

On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.comwrote:
>
>
>

Quote:

Originally Posted by

Here's a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.


>

Quote:

Originally Posted by

<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>


>

Quote:

Originally Posted by

Could I use ASP 3 <%%tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there's a better solution than using a GridView. Any other
ideas?


>
In this case you should rewrite a GridView_RowDataBound event.
>
Change <asp:GridView ID="GridView1"
OnRowDataBound="GridView1_RowDataBound"...
>
and add the GridView1_RowDataBound event to your code (code-behind)
>
C#:
>
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
>
if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
>
}
}
>
I didn't test it but it should work, I think


OK. I may be getting this now. I made this the first line of my
default.aspx.

<%@. Page Language="C#" AutoEventWireup="false"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

And this is the contents of the default.aspx.cs file. Renamed my grid
GridView2 by the way.

protected void GridView2_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"];
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
}
}

Getting these compilation errors.

c:\...Default.aspx.cs(1,11): error CS1518: Expected class, delegate,
enum, interface, or struct
c:\...Default.aspx.cs(6,27): error CS1001: Identifier expected
c:\...Default.aspx.cs(9,1): error CS1022: Type or namespace
definition, or end-of-file expected

I feel like I'm getting close but I just can't get it. Thank you for
your help.

TF
On Mar 18, 9:24 pm, "TF" <TJForw...@.gmail.comwrote:

Quote:

Originally Posted by

On Mar 18, 4:20 am, "Alexey Smirnov" <alexey.smir...@.gmail.comwrote:
>
>
>
>
>

Quote:

Originally Posted by

On Mar 17, 10:26 pm, "TF" <TJForw...@.gmail.comwrote:


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Here's a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.


>

Quote:

Originally Posted by

Quote:

Originally Posted by

<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Could I use ASP 3 <%%tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there's a better solution than using a GridView. Any other
ideas?


>

Quote:

Originally Posted by

In this case you should rewrite a GridView_RowDataBound event.


>

Quote:

Originally Posted by

Change <asp:GridView ID="GridView1"
OnRowDataBound="GridView1_RowDataBound"...


>

Quote:

Originally Posted by

and add the GridView1_RowDataBound event to your code (code-behind)


>

Quote:

Originally Posted by

C#:


>

Quote:

Originally Posted by

protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{


>

Quote:

Originally Posted by

if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"]; // e.g. "#000000"
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);


>

Quote:

Originally Posted by

}
}


>

Quote:

Originally Posted by

I didn't test it but it should work, I think


>
OK. I may be getting this now. I made this the first line of my
default.aspx.
>
<%@. Page Language="C#" AutoEventWireup="false"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
>
And this is the contents of the default.aspx.cs file. Renamed my grid
GridView2 by the way.
>
protected void GridView2_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string c = e.Row.DataItem["RGBHex"];
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(c);
>
}
}
>
Getting these compilation errors.
>
c:\...Default.aspx.cs(1,11): error CS1518: Expected class, delegate,
enum, interface, or struct
c:\...Default.aspx.cs(6,27): error CS1001: Identifier expected
c:\...Default.aspx.cs(9,1): error CS1022: Type or namespace
definition, or end-of-file expected
>
I feel like I'm getting close but I just can't get it. Thank you for
your help.
>
TF- Hide quoted text -
>
- Show quoted text -


Mate, you have to start from the basic.

It told you that you miss a class, that is you have to define the
_Default

Remember, you said <%@. Page ... Inherits="_Default"
<!----- This is the name of your class

So, the code-behind should be like this:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}

...............code here...............

}
On Mar 17, 7:26 am, "TF" <TJForw...@.gmail.comwrote:

Quote:

Originally Posted by

Very newbie question and I hope this is the right group. I have a
table on a web page which contains info about paint colors. One column
contains the hex value for the color's RGB value. I want to display
info from the table in a grid or table and use the column value from
the RGBHex column to set each row's back ground color. I can just
about do this in my sleep in old style ASP using <%%tags but I would
like to implement it in .NET 2. My website has this implemented in
old ASP here: www.paintmatcher.com/tool/tool.asp Any help is greatly
appreciated.


Got it to work now. Thank you all very much!

Thursday, March 29, 2012

Set Column Width in DataList

I have a datalist that displays data from an SQL Server 2000 DB. One of the
fields contains names in the format "LastName FI". When the data is
displayed for that field it seems to base the width of the column on the
longest value of LastName which means I often get the lastname on one line
and the first initial on a second line (I guess is breaks on the space?)

How can I circumvent that second line? I tried adding code to set the column
width but it is not having any effect?

WayneTry putting a <DIV> into the cell. Browsers tend to do whatever suits them
with tables.

"Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
news:e83PD54PEHA.1160@.TK2MSFTNGP09.phx.gbl...
> I have a datalist that displays data from an SQL Server 2000 DB. One of
the
> fields contains names in the format "LastName FI". When the data is
> displayed for that field it seems to base the width of the column on the
> longest value of LastName which means I often get the lastname on one line
> and the first initial on a second line (I guess is breaks on the space?)
> How can I circumvent that second line? I tried adding code to set the
column
> width but it is not having any effect?
> Wayne
Rick;

Sorry to be dense but I am not clear on how to use a <DIV> tag to prevent a
field from wrapping?

Wayne

"Rick Spiewak" <rickspiewak@.mindspring.com> wrote in message
news:uVKaH06PEHA.640@.TK2MSFTNGP09.phx.gbl...
> Try putting a <DIV> into the cell. Browsers tend to do whatever suits them
> with tables.
> "Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
> news:e83PD54PEHA.1160@.TK2MSFTNGP09.phx.gbl...
> > I have a datalist that displays data from an SQL Server 2000 DB. One of
> the
> > fields contains names in the format "LastName FI". When the data is
> > displayed for that field it seems to base the width of the column on the
> > longest value of LastName which means I often get the lastname on one
line
> > and the first initial on a second line (I guess is breaks on the space?)
> > How can I circumvent that second line? I tried adding code to set the
> column
> > width but it is not having any effect?
> > Wayne
Something like:
<DIV style="WIDTH: 100px"
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Set Column Width in DataList

I have a datalist that displays data from an SQL Server 2000 DB. One of the
fields contains names in the format "LastName FI". When the data is
displayed for that field it seems to base the width of the column on the
longest value of LastName which means I often get the lastname on one line
and the first initial on a second line (I guess is breaks on the space?)
How can I circumvent that second line? I tried adding code to set the column
width but it is not having any effect?
WayneTry putting a <DIV> into the cell. Browsers tend to do whatever suits them
with tables.
"Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
news:e83PD54PEHA.1160@.TK2MSFTNGP09.phx.gbl...
> I have a datalist that displays data from an SQL Server 2000 DB. One of
the
> fields contains names in the format "LastName FI". When the data is
> displayed for that field it seems to base the width of the column on the
> longest value of LastName which means I often get the lastname on one line
> and the first initial on a second line (I guess is breaks on the space?)
> How can I circumvent that second line? I tried adding code to set the
column
> width but it is not having any effect?
> Wayne
>
Rick;
Sorry to be dense but I am not clear on how to use a <DIV> tag to prevent a
field from wrapping?
Wayne
"Rick Spiewak" <rickspiewak@.mindspring.com> wrote in message
news:uVKaH06PEHA.640@.TK2MSFTNGP09.phx.gbl...
> Try putting a <DIV> into the cell. Browsers tend to do whatever suits them
> with tables.
> "Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
> news:e83PD54PEHA.1160@.TK2MSFTNGP09.phx.gbl...
> the
line
> column
>
Something like:
<DIV style="WIDTH: 100px">
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Monday, March 26, 2012

Set Enabled to false for multiple web controls

Hi,
I have a usercontrol which contains multiple server controls like
textbox, radiobutton..., I have a public field in the usercontrol
"Enabled". What i want to do is when the usercontrol's "Enabled" is
set to false, set all its child controls "Enabled" to false. I know i
can set them one by one. But there should be a easy way to do it
like :
for(int i=0;i<myUserControl.Controls.Count;i++)
{
control oControl = (control) myUserControl.Controls(i);
oControl.Enabled = false;
}
Anyone can give me a hint?
ElaineOn May 23, 9:01 pm, elaine <elain...@.gmail.com> wrote:
> But there should be a easy way to do it
> like :
> for(int i=0;i<myUserControl.Controls.Count;i++)
> {
> control oControl = (control) myUserControl.Controls(i);
> oControl.Enabled = false;
> }
> Anyone can give me a hint?
Sorry, I'm not clear on your question...
..do you mean that the for loop you wrote up there doesn't work ?
If it does, that seems fairly simple to me.. maybe I'd try to save a
line with:
foreach(Control ctrl in this.Controls)
ctrl.Enabled=false;
However, I don't think that the base Control class defines an Enabled
property, and that might be a problem. Then again, a Control might be
a label, a text literal, a generic html control, a bunch of things
were it's not quite clear what it means to be 'enabled' or not. Maybe
when 'enabled' is turned to false on your user control, you just don't
want to display any of its children controls ?
If so, at render time, you could check the value of the user control's
Enabled property:
if(this.Enabled)
base.Render(writer);
HTH,
~O
You could use control tree recursion to touch all the controls in the way
you describe.
Here are the details:
http://SteveOrr.net/faq/ControlTreeRecursion.aspx
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"elaine" <elain.sun@.gmail.com> wrote in message
news:1179968508.834610.110610@.n15g2000prd.googlegroups.com...
> Hi,
> I have a usercontrol which contains multiple server controls like
> textbox, radiobutton..., I have a public field in the usercontrol
> "Enabled". What i want to do is when the usercontrol's "Enabled" is
> set to false, set all its child controls "Enabled" to false. I know i
> can set them one by one. But there should be a easy way to do it
> like :
> for(int i=0;i<myUserControl.Controls.Count;i++)
> {
> control oControl = (control) myUserControl.Controls(i);
> oControl.Enabled = false;
> }
> Anyone can give me a hint?
> Elaine
>

Set Enabled to false for multiple web controls

Hi,

I have a usercontrol which contains multiple server controls like
textbox, radiobutton..., I have a public field in the usercontrol
"Enabled". What i want to do is when the usercontrol's "Enabled" is
set to false, set all its child controls "Enabled" to false. I know i
can set them one by one. But there should be a easy way to do it
like :

for(int i=0;i<myUserControl.Controls.Count;i++)
{
control oControl = (control) myUserControl.Controls(i);
oControl.Enabled = false;
}

Anyone can give me a hint?

ElaineOn May 23, 9:01 pm, elaine <elain...@.gmail.comwrote:

Quote:

Originally Posted by

But there should be a easy way to do it
like :
>
for(int i=0;i<myUserControl.Controls.Count;i++)
{
control oControl = (control) myUserControl.Controls(i);
oControl.Enabled = false;
>
}
>
Anyone can give me a hint?


Sorry, I'm not clear on your question...
...do you mean that the for loop you wrote up there doesn't work ?
If it does, that seems fairly simple to me.. maybe I'd try to save a
line with:

foreach(Control ctrl in this.Controls)
ctrl.Enabled=false;

However, I don't think that the base Control class defines an Enabled
property, and that might be a problem. Then again, a Control might be
a label, a text literal, a generic html control, a bunch of things
were it's not quite clear what it means to be 'enabled' or not. Maybe
when 'enabled' is turned to false on your user control, you just don't
want to display any of its children controls ?
If so, at render time, you could check the value of the user control's
Enabled property:

if(this.Enabled)
base.Render(writer);

HTH,
~O
You could use control tree recursion to touch all the controls in the way
you describe.
Here are the details:
http://SteveOrr.net/faq/ControlTreeRecursion.aspx
--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"elaine" <elain.sun@.gmail.comwrote in message
news:1179968508.834610.110610@.n15g2000prd.googlegr oups.com...

Quote:

Originally Posted by

Hi,
>
I have a usercontrol which contains multiple server controls like
textbox, radiobutton..., I have a public field in the usercontrol
"Enabled". What i want to do is when the usercontrol's "Enabled" is
set to false, set all its child controls "Enabled" to false. I know i
can set them one by one. But there should be a easy way to do it
like :
>
for(int i=0;i<myUserControl.Controls.Count;i++)
{
control oControl = (control) myUserControl.Controls(i);
oControl.Enabled = false;
}
>
Anyone can give me a hint?
>
Elaine
>

Tuesday, March 13, 2012

set public property in another web user control

I have two user controls in a web form...user control 1 contains just a
label, but I want to set its value from another web user control (2) in the
same web form. I am able to set the value from the web form, but not from
the user control 2...what am I doing wrong?
This is in the web form:
<uc1:statusMessage id="StatusMessage1" runat="server"></uc1:statusMessage>
This is in the first user control 1:
Public theMessage As String
Public Property statusMessage() As String
Get
lblStatusMessage.Text = theMessage
End Get
Set(ByVal Value As String)
theMessage = Value
End Set
End Property
This is in the user control 2:
Public WithEvents statusMessage1 As statusMessage
statusMessage1.theMessage = "No communities selected"
_____
DC GDingo:
Check out:
http://openmymind.net/index.aspx?documentId=9
I'm in a rush, else I'd explain in great detail :) lemme know if that solved
it for you...
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:OgKTBCgSFHA.3176@.TK2MSFTNGP09.phx.gbl...
>I have two user controls in a web form...user control 1 contains just a
>label, but I want to set its value from another web user control (2) in the
>same web form. I am able to set the value from the web form, but not from
>the user control 2...what am I doing wrong?
> This is in the web form:
> <uc1:statusMessage id="StatusMessage1" runat="server"></uc1:statusMessage>
>
> This is in the first user control 1:
> Public theMessage As String
> Public Property statusMessage() As String
> Get
> lblStatusMessage.Text = theMessage
> End Get
> Set(ByVal Value As String)
> theMessage = Value
> End Set
> End Property
>
>
> This is in the user control 2:
> Public WithEvents statusMessage1 As statusMessage
> statusMessage1.theMessage = "No communities selected"
> _____
> DC G
>

set public property in another web user control

I have two user controls in a web form...user control 1 contains just a
label, but I want to set its value from another web user control (2) in the
same web form. I am able to set the value from the web form, but not from
the user control 2...what am I doing wrong?

This is in the web form:

<uc1:statusMessage id="StatusMessage1" runat="server"></uc1:statusMessage
This is in the first user control 1:

Public theMessage As String
Public Property statusMessage() As String
Get
lblStatusMessage.Text = theMessage
End Get
Set(ByVal Value As String)
theMessage = Value
End Set
End Property

This is in the user control 2:

Public WithEvents statusMessage1 As statusMessage
statusMessage1.theMessage = "No communities selected"

_____
DC GDingo:
Check out:
http://openmymind.net/index.aspx?documentId=9

I'm in a rush, else I'd explain in great detail :) lemme know if that solved
it for you...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)

"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:OgKTBCgSFHA.3176@.TK2MSFTNGP09.phx.gbl...
>I have two user controls in a web form...user control 1 contains just a
>label, but I want to set its value from another web user control (2) in the
>same web form. I am able to set the value from the web form, but not from
>the user control 2...what am I doing wrong?
> This is in the web form:
> <uc1:statusMessage id="StatusMessage1" runat="server"></uc1:statusMessage>
>
> This is in the first user control 1:
> Public theMessage As String
> Public Property statusMessage() As String
> Get
> lblStatusMessage.Text = theMessage
> End Get
> Set(ByVal Value As String)
> theMessage = Value
> End Set
> End Property
>
>
> This is in the user control 2:
> Public WithEvents statusMessage1 As statusMessage
> statusMessage1.theMessage = "No communities selected"
> _____
> DC G