Showing posts with label column. Show all posts
Showing posts with label column. 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 Headertext

Hi
I have a Datagrid with a templatecolumn, where I add at design time. I also checked the "create columns automatically"
I would like to change the headertext of columns created automatically, but i don't know in which event I can do that

Can you help me

P.S. I tryied to set the headertext in the "PreRender" event of the DataGrid, but in this point the grid has still only the templatecolumn, and the others columns aren't created yet

Thank you
Alessandro RossHi, Alessandro Rossi,

If you extend the DataGrid class (inherit from it) the best place is the
OnDataBinding protected method. You should first call base.OnDataBinding(e);
of course.

If you are simply using the DataGrid class - set the headertexts after you
call DataBind() because the columns are in fact created with this call.

Hope this helps
Martin
"Alessandro Rossi" <alessandro.rossi@.areait.net> wrote in message
news:528CD483-7F36-4D2A-8760-24CD36F0BE8A@.microsoft.com...
> Hi,
> I have a Datagrid with a templatecolumn, where I add at design time. I
also checked the "create columns automatically".
> I would like to change the headertext of columns created automatically,
but i don't know in which event I can do that.
> Can you help me?
> P.S. I tryied to set the headertext in the "PreRender" event of the
DataGrid, but in this point the grid has still only the templatecolumn, and
the others columns aren't created yet.
> Thank you.
> Alessandro Rossi

set column distances for RadioButtonList

Hello,
I have a radioButtonList and set RepeatColumns to 2.
However, the distance between radiobutton in column1 and radiobutton
in column2 is too close.
Can someone how to set the distance (either with CSS or not)?
Many Thanks
JerryHave you tried using cellspacing for the radiobuttonlist?
I mean something like
<asp:RadioButtonList ID="RadioBtnList" runat="server" RepeatColumns="2"
CellSpacing="10">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:RadioButtonList>
--
>From: DAXU@.hotmail.com
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Subject: set column distances for RadioButtonList
>Date: Tue, 4 Dec 2007 08:23:18 -0800 (PST)
>Organization: http://groups.google.com
>Lines: 11
>Message-ID:
<5b0fa9e7-9fe6-4fca-8150-56abb4a67d6e@.f3g2000hsg.googlegroups.com>
>NNTP-Posting-Host: 80.5.93.39
>Mime-Version: 1.0
>Content-Type: text/plain; charset=ISO-8859-1
>Content-Transfer-Encoding: 7bit
>X-Trace: posting.google.com 1196785399 22323 127.0.0.1 (4 Dec 2007
16:23:19 GMT)
>X-Complaints-To: groups-abuse@.google.com
>NNTP-Posting-Date: Tue, 4 Dec 2007 16:23:19 +0000 (UTC)
>Complaints-To: groups-abuse@.google.com
>Injection-Info: f3g2000hsg.googlegroups.com; posting-host=80.5.93.39;
> posting-account=a-mEAAoAAABlXzZHzkVMW2qA_BbvR8Hj
>User-Agent: G2/1.0
>X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US;
rv:1.8.1.11)
> Gecko/20071127 Firefox/2.0.0.11,gzip(gfe),gzip(gfe)
>Content-Disposition: inline
>Path:
TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTFEEDS02.phx.gbl!newsfeed0
0.sul.t-online.de!t-online.de!news.glorb.com!postnews.google.com!f3g2000hsg.
googlegroups.com!not-for-mail
>Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet:52366
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>Hello,
>I have a radioButtonList and set RepeatColumns to 2.
>However, the distance between radiobutton in column1 and radiobutton
>in column2 is too close.
>Can someone how to set the distance (either with CSS or not)?
>Many Thanks
>Jerry
>
Thank You,
Nanda Lella,
This Posting is provided "AS IS" with no warranties, and confers no rights.

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 div width to remaining width of the browser

using float: left and float: right to build a two column page
layout.
<div style="float:left">column 1</div>
<div style="float:right">column 2</div>
then I set the width of the first column to a fixed size:
<div style="float:left; width:10em;>column 1</div>
how can I set the width of the 2nd column, the float:right div, to
fill the remaining space of its container?
I know I can use percentages, but I want the left column to always be
the same fixed length.
Is this a case where <table> is the obvious solution?
thanks,
-SteveDo you need this?
<div style="float:left; width: 10em; border: solid 1px red">
ZZZZZ
</div>
<div style="margin-left: 10em; border: solid 1px green">
www
<div>

> using float: left and float: right to build a two column page
> layout.
> <div style="float:left">column 1</div>
> <div style="float:right">column 2</div>
> then I set the width of the first column to a fixed size: <div
> style="float:left; width:10em;>column 1</div>
> how can I set the width of the 2nd column, the float:right div, to
> fill the remaining space of its container?
> I know I can use percentages, but I want the left column to always be
> the same fixed length.
> Is this a case where <table> is the obvious solution?
> thanks,
> -Steve
>
On Jun 15, 2:00 pm, Yuriy Solodkyy <y.dot.solod...@.gmail.com> wrote:
> Do you need this?
> <div style="float:left; width: 10em; border: solid 1px red">
> ZZZZZ
> </div>
> <div style="margin-left: 10em; border: solid 1px green">
> www
> <div>
>
thank you. I just read of the margin technique in a very good book I
have:
http://www.amazon.com/CSS-Anthology...81932373&sr=8-1
a lot of CSS positioning seems to be a hack. esp if you dont want to
use javascript out of concern of complicating things even further.
I assume CSS does not allow one div to reference another for is
position and size? That would seem to be ideal for page layouts.
( where the height of div a is always the height of div b, div c
always has the same absolute X position of div d, ... )
thanks,
-Steve

set div width to remaining width of the browser

using float: left and float: right to build a two column page
layout.
<div style="float:left">column 1</div>
<div style="float:right">column 2</div>

then I set the width of the first column to a fixed size:
<div style="float:left; width:10em;>column 1</div>

how can I set the width of the 2nd column, the float:right div, to
fill the remaining space of its container?

I know I can use percentages, but I want the left column to always be
the same fixed length.

Is this a case where <tableis the obvious solution?

thanks,

-SteveDo you need this?

<div style="float:left; width: 10em; border: solid 1px red">
ZZZZZ
</div>
<div style="margin-left: 10em; border: solid 1px green">
www
<div>

Quote:

Originally Posted by

using float: left and float: right to build a two column page
layout.
<div style="float:left">column 1</div>
<div style="float:right">column 2</div>
then I set the width of the first column to a fixed size: <div
style="float:left; width:10em;>column 1</div>
>
how can I set the width of the 2nd column, the float:right div, to
fill the remaining space of its container?
>
I know I can use percentages, but I want the left column to always be
the same fixed length.
>
Is this a case where <tableis the obvious solution?
>
thanks,
>
-Steve
>


On Jun 15, 2:00 pm, Yuriy Solodkyy <y.dot.solod...@.gmail.comwrote:

Quote:

Originally Posted by

Do you need this?
>
<div style="float:left; width: 10em; border: solid 1px red">
ZZZZZ
</div>
<div style="margin-left: 10em; border: solid 1px green">
www
<div>
>


thank you. I just read of the margin technique in a very good book I
have:
http://www.amazon.com/CSS-Anthology...81932373&sr=8-1
a lot of CSS positioning seems to be a hack. esp if you dont want to
use javascript out of concern of complicating things even further.

I assume CSS does not allow one div to reference another for is
position and size? That would seem to be ideal for page layouts.
( where the height of div a is always the height of div b, div c
always has the same absolute X position of div d, ... )

thanks,

-Steve

Saturday, March 24, 2012

Set focus to DAtagrid Cell

I hae a WEB application that uses a datagrid. My first 2 rows are Template
columns with Dropdown lists. My Third column as databound cell. When I go
to edit a particular row I want the focus to change to the third row. I am
using Visual Studio VB.Net with WEB Forms. Any Help would be great.It is not clear what exactly you want. Anyway, setting focus is a
client-side task. You have to produce some javascript which will operate on
the client DHTML presentation of the grid.

Eliyahu

"rroca" <oeb@.homexperts.net> wrote in message
news:C3CD2487-6FD7-4830-A20D-E14E18CA56F1@.microsoft.com...
> I hae a WEB application that uses a datagrid. My first 2 rows are
Template
> columns with Dropdown lists. My Third column as databound cell. When I
go
> to edit a particular row I want the focus to change to the third row. I
am
> using Visual Studio VB.Net with WEB Forms. Any Help would be great.

Set focus to DAtagrid Cell

I hae a WEB application that uses a datagrid. My first 2 rows are Template
columns with Dropdown lists. My Third column as databound cell. When I go
to edit a particular row I want the focus to change to the third row. I am
using Visual Studio VB.Net with WEB Forms. Any Help would be great.It is not clear what exactly you want. Anyway, setting focus is a
client-side task. You have to produce some javascript which will operate on
the client DHTML presentation of the grid.
Eliyahu
"rroca" <oeb@.homexperts.net> wrote in message
news:C3CD2487-6FD7-4830-A20D-E14E18CA56F1@.microsoft.com...
> I hae a WEB application that uses a datagrid. My first 2 rows are
Template
> columns with Dropdown lists. My Third column as databound cell. When I
go
> to edit a particular row I want the focus to change to the third row. I
am
> using Visual Studio VB.Net with WEB Forms. Any Help would be great.