Saturday, March 31, 2012

Set a bgcolor in a repeater based on databse value asp newbie

Hi,

I'm just starting to write in asp and have been trying to create a repeater
to display some data in a simple form.

The basics worked ok and then I tried to set a bgcolor on a cell based on
it's value, I have read and re-read a good few things but nothing seems to
point to this scenario directly. I know the following code doesn't actually
work but this is roughly what I'm trying to do. eventually I want to do the
same thing with dates but baby steps first :)

<ItemTemplate>
<%If #(DataBinder.Eval(Container.DataItem, "CategoryName") =
"something") Then%>'
<tr>
<td bgcolor="#ff0000">
<%Else%>
<tr>
<td bgcolor="#CCFFCC">
<% End If%>
<asp:Label runat="server" ID="Labell" Text='<%#
Eval("CategoryName") %>' />
</td>
<td bgcolor="#CCFFCC">
<asp:Label runat="server" ID="Label2" Text='<%#
Eval("Description") %>' />
</td>
</tr>
</ItemTemplate
Thanks in advance for any help

Jim FlorenceInstead of attempting to change the colour of the <ItemTemplate>, add an
<AlternatingItemTemplate> section and type the colour in there. dotNet will
then take care of the rest for you.

"Jim Florence" wrote:

> Hi,
> I'm just starting to write in asp and have been trying to create a repeater
> to display some data in a simple form.
> The basics worked ok and then I tried to set a bgcolor on a cell based on
> it's value, I have read and re-read a good few things but nothing seems to
> point to this scenario directly. I know the following code doesn't actually
> work but this is roughly what I'm trying to do. eventually I want to do the
> same thing with dates but baby steps first :)
> <ItemTemplate>
> <%If #(DataBinder.Eval(Container.DataItem, "CategoryName") =
> "something") Then%>'
> <tr>
> <td bgcolor="#ff0000">
> <%Else%>
> <tr>
> <td bgcolor="#CCFFCC">
> <% End If%>
> <asp:Label runat="server" ID="Labell" Text='<%#
> Eval("CategoryName") %>' />
> </td>
> <td bgcolor="#CCFFCC">
> <asp:Label runat="server" ID="Label2" Text='<%#
> Eval("Description") %>' />
> </td>
> </tr>
> </ItemTemplate>
> Thanks in advance for any help
> Jim Florence
"Dean" <Dean@.discussions.microsoft.com> wrote in message
news:79F7A0BD-A3ED-4605-8CE4-89DACF298D04@.microsoft.com...
Dean,

Thanks for the reply, that works great for the entire row but not for
individual cells within the row based on the cell's value or name.

What I'm eventually trying to do is set an individual date cell to be either
red, amber or green depending on how many days overdue an item is

Many thanks again

Jim

>Instead of attempting to change the colour of the <ItemTemplate>, add an
> <AlternatingItemTemplate> section and type the colour in there. dotNet
> will
> then take care of the rest for you.
>
> "Jim Florence" wrote:
>>
>> Hi,
>>
>> I'm just starting to write in asp and have been trying to create a
>> repeater
>> to display some data in a simple form.
>>
>> The basics worked ok and then I tried to set a bgcolor on a cell based on
>> it's value, I have read and re-read a good few things but nothing seems
>> to
>> point to this scenario directly. I know the following code doesn't
>> actually
>> work but this is roughly what I'm trying to do. eventually I want to do
>> the
>> same thing with dates but baby steps first :)
>>
>> <ItemTemplate>
>> <%If #(DataBinder.Eval(Container.DataItem, "CategoryName") =
>> "something") Then%>'
>> <tr>
>> <td bgcolor="#ff0000">
>> <%Else%>
>> <tr>
>> <td bgcolor="#CCFFCC">
>> <% End If%>
>> <asp:Label runat="server" ID="Labell" Text='<%#
>> Eval("CategoryName") %>' />
>> </td>
>> <td bgcolor="#CCFFCC">
>> <asp:Label runat="server" ID="Label2" Text='<%#
>> Eval("Description") %>' />
>> </td>
>> </tr>
>> </ItemTemplate>
>>
>> Thanks in advance for any help
>>
>> Jim Florence
>>
Jim,

Try this instead:
<td bgcolor='<%#(DataBinder.Eval(Container.DataItem, "CategoryName") ==
"something"?"#ff0000":"#ffffff"%>'
This assumes that you are in C#, in VB i think there is a immediate if
of IIf();

HTH,
Chris
"chris" <chris@.cubed-c.com> wrote in message
news:1151142480.516385.115290@.m73g2000cwd.googlegr oups.com...
Chris your a star,

After very minor fiddling the code is

<td bgcolor='<%# IIF (DataBinder.Eval(Container.DataItem, "CategoryName") =
"Confections","#ff0000","#ccffcc")%>'
Thanks very much for your help I tearing my hair out trying to make this
work

Regards

Jim

> Jim,
> Try this instead:
> <td bgcolor='<%#(DataBinder.Eval(Container.DataItem, "CategoryName") ==
> "something"?"#ff0000":"#ffffff"%>'>
> This assumes that you are in C#, in VB i think there is a immediate if
> of IIf();
> HTH,
> Chris

set a date value

Dear sir,

We are on the week of 27 in year 2004. So this week is "2004-27", last week
is "2004-26",

My question is how can I get the first sunday of week "2004-26", how can I
change string "2004-26" into a DateTime variable with the value of first
sunday of week 2004-26?

--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.comThe easiest way I could think of would be to check what the first day of the
year is (1/1/2004) through the DayOfWeek property of the DateTime class and
calculate the offset between it and the previous Sunday.

For 2004, calling DateTime.DayOfWeek for 1/1/2004 would return Thursday.
Therefore, the first week of 2004 (by week numbers) started on Sunday,
12/28/2003. To determine the Sunday starting any given week during 2004 you
could simply calculate it via:

public DateTime GetWeekStart(int WeekNumber)
{
return FirstSundayOfYear.AddDays(7*(WeekNumber-1));
}

The rationale for (WeekNumber-1) is that the FirstSundayOfYear would already
be set to 12/28/2003 so if you were looking for week 1 then you would want
to add 0 days as opposed to 7.

You indicated that you wanted to convert a string (2004-26) into a DateTime
for the first sunday of each week. What I would probably do in this
scenario since obviously no direct conversion exists would be to define a
WeekDictionary class derived from System.Collections.DictionaryBase and set
the key of the key to the desired string and the value to the appropriate
DateTime value.

Hope this helps!

"Guoqi Zheng" <no@.sorry.nl> wrote in message
news:uIdNKvDXEHA.128@.TK2MSFTNGP10.phx.gbl...
> Dear sir,
> We are on the week of 27 in year 2004. So this week is "2004-27", last
week
> is "2004-26",
> My question is how can I get the first sunday of week "2004-26", how can I
> change string "2004-26" into a DateTime variable with the value of first
> sunday of week 2004-26?
> --
> Kind regards
> Guoqi Zheng
> guoqi AT meetholland dot com
> Http://www.meetholland.com

Set a custom object property in a user control

hi, i have a user control that have a property MyProp of type MyObject.

MyObject also have a property named Prop1;

I want to set Prop1 in the aspx.

For example

<User:MyControl id="control>

<MyProp Prop1="value" />

</User:MyControl>

and

public class MyObject

{

public string Prop1 {get; set;}

}

This code works but i can't go to Design View becouse contents isn't allowed between openin and closing tag of an user control)

Somebody have a solution? ( i don't ant to change my user Control to a server control)

thanks

You cant have content between opening and closing tags.

Your code should be like as below:

<User:MyControl id="control"

Prop1="value">

</User:MyControl>

Try this and let me know if any issues


thanks for your reply but i don't need to set a property of my control, i need to set some properties of an object returned by a property of my control and

i neither want to remap all this properties to some new properties of the control becouse are too match;

a better example is (some implementation details are hidden):

class User

{

public string Name { set; }

public string Surname {set;}

}

class UserView : UserControl

{

public User TargetUser {get;}

}

and in the page

<MyControls:UserView id="userView1">

<TargetUser Name="sam" Surname="foofoo" />

</MyControls:UserView>

This code works but i can't switch to DesignView becouse Visual Studio see contents into my control tags.

I want know if there's a way to set Name and Value property of internal User object into the aspx without problems with visual studio parser.


set a cookie clientside on Textbox onChange

Hi,
I have a textbox, I need to set a cookie to the value of the textbox... when
textbox.Text changes.

How do I do this using clientSide script (javascript) only.

I do not want to post back to the server and then set the cookie using
server script.

Any help is very appretiated (I did search the internet)...
Nalakahttp://techpatterns.com/downloads/j...ipt_cookies.php
Pretty standard pattern, ASP.NET or otherwise.
:-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
"Nalaka" <nalaka12@.nospam.nospamwrote in message
news:%23vE8eBAwGHA.1956@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

Hi,
I have a textbox, I need to set a cookie to the value of the textbox...
when textbox.Text changes.
>
How do I do this using clientSide script (javascript) only.
>
I do not want to post back to the server and then set the cookie using
server script.
>
Any help is very appretiated (I did search the internet)...
Nalaka
>
>


Hi Nalaka,

I think the article Gregory provided is quite good and useful.

BTW, client-side inserted cookie may escape some special characters. When
reading them in server-side code, you may take care on this, you can use
the UrlDecode method to decode them if the cookie(added at client-side) is
escaped:

foreach (string key in Request.Cookies.Keys)
{
Response.Write("<br/>" + key + ": " +
Server.UrlDecode(Request.Cookies[key].Value));
}

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks all.....

"Steven Cheng[MSFT]" <stcheng@.online.microsoft.comwrote in message
news:pLngR8CwGHA.1992@.TK2MSFTNGXA01.phx.gbl...

Quote:

Originally Posted by

Hi Nalaka,
>
I think the article Gregory provided is quite good and useful.
>
BTW, client-side inserted cookie may escape some special characters. When
reading them in server-side code, you may take care on this, you can use
the UrlDecode method to decode them if the cookie(added at client-side) is
escaped:
>
foreach (string key in Request.Cookies.Keys)
{
Response.Write("<br/>" + key + ": " +
Server.UrlDecode(Request.Cookies[key].Value));
}
>
Sincerely,
>
Steven Cheng
>
Microsoft MSDN Online Support Lead
>
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>

Set a condition before following a hyperlink

In straightforward html I have used the following:-

<a onClick="return checkpass(Checkit.PassToForm.value);" href="http://links.10026.com/?link=myweb3/members.htm">Continue

where checkpass is a function that returns true or false and it has to be true before the user can access the next page.

Validation controls would not be an answer in this particular instance

I have not been able to do the same sort of thing in ASP. onclick = "return Somefunction"; href etc produces an error message "Somefunction isundefined"


In Asp, if the OnClick event is already defined for the webcontrol, then it is expecting a C# function handler. In this case, you will need to use OnClientClick.

I would suggest using a LinkButton. This will ensure that people are validated when going to the next page, cause if javascript is disabled then the link button wont redirect the user.

<asp:LinkButton ID="lb" runat="server" Text="Gohere" OnClientClick="return checkpass("myvalue")" />


You would need preventDefault.http://developer.mozilla.org/en/docs/DOM:event.preventDefault

But it is not supported in old browsers.


Hi

I think the checkpass function is some sort of a client side scripting function (probably javascript). If that is right I would suggest you to open the new page from the javascript function itself rather than using href.

Hope this helps to solve your problem

Good LuckYes

Regards

Vineed


Hi,

Mulozi:

<a onClick="return checkpass(Checkit.PassToForm.value);" href="http://links.10026.com/?link=myweb3/members.htm">Continue

You can redirect the page in the javascript function itself. So your fucntion checks the details and if correct it will transfer to another page.

use the below...

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function checkDetails()
{
if(document.getElementById("txt").value != "")
{
window.location.href="default2.aspx";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txt" runat="server"></asp:TextBox><br />
<a onclick="checkDetails();" href="http://links.10026.com/?link=http://forums.asp.net/AddPost.aspx?ReplyToPostID=1967328&Quote=False#"> Hi</a></div>
</form>
</body>
</html>


Thanks.

I should have mentioned that I am using VB for this application. Sorry to have put you to the trouble.

I seem to have succeeded in a previous application which used Javascript.

I have to use VB for this one and am trying to find the VB equivalent.

Thee must be an equivalent somehow using VB

I should also have mentioned that I have been using Visual Web Developer 2008 express edition


Thanks.

I haven't been able to succeed with this either

I should have mentioned that I am using VB for this application. Sorry to have put you to the trouble.

I seem to have succeeded in a previous application which used Javascript. and the previous example was Javascript .

I have to use VB for this one and am trying to find the VB equivalent.

There must be an equivalent somehow using VB

Can I not run a script from the command button which would include a conditional go to URL ... ?

I should also have mentioned that I have been using Visual Web Developer 2008 express edition

Any further thoughts gratefully received.


Thanks.

I presume preventDefault is Javascript

I should have mentioned that I am using VB for this application.

I seem to have succeeded in a previous application which used Javascript. and the previous example was Javascript .

I have to use VB for this one and am trying to find the VB equivalent.

There must be an equivalent somehow using VB

Can I not run a script from the command button which would include a conditional go to URL ... ? I have not found a way of doing it, but this must be a common enough requirement.

I should also have mentioned that I have been using Visual Web Developer 2008 express edition

Any further thoughts gratefully received.


Hi,

Are you trying to execute the function on the client-side or server side. If you can execute it on the server side, then instead of a hyperlink use a linkbutton and on the click event of it check the condition that you are looking out for and use Response.Redirect to the new page. That should possibly solve the problem.

Hope this solves your problem

Good LuckYes

Regards

Vineed

Set a default property in a user control?

I'm not even sure if what I'm doing is possible. I created a simple control
that will be reused throughout the site. It will accept a large amount of
HTML with bulleted lists, etc
I want to implement like:
<uc1:KeyFeatures id="KeyFeatures1" runat="server">
Large amount of Inner Html content goes here between tags...
</uc1:KeyFeatures>
Not like:
<uc1:KeyFeatures id="KeyFeatures1" runat="server" InnerHtml="Large amount of
Inner Html content goes here between tags..."></uc1:KeyFeatures>
Can I do it this way? If so, is this considered the 'default' property and h
ow do I declare this in my uc so it accepts the text between the tags?
The code is below..this is a stripped down version.
public class KeyFeatures : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Label lblInnerHtml;
public string InnerHtml
{
set
{
lblInnerHtml.Text = value;
}
}If you find can you please tell here how you do?
Iyigun
"Dave" <anonymous@.discussions.microsoft.com> wrote in message
news:243F1108-1CB3-4F93-8386-BE39FC3601CA@.microsoft.com...
> I'm not even sure if what I'm doing is possible. I created a simple
control that will be reused throughout the site. It will accept a large
amount of HTML with bulleted lists, etc
> I want to implement like:
> <uc1:KeyFeatures id="KeyFeatures1" runat="server">
> Large amount of Inner Html content goes here between tags...
> </uc1:KeyFeatures>
> Not like:
> <uc1:KeyFeatures id="KeyFeatures1" runat="server" InnerHtml="Large amount
of Inner Html content goes here between tags..."></uc1:KeyFeatures>
> Can I do it this way? If so, is this considered the 'default' property and
how do I declare this in my uc so it accepts the text between the tags?
> The code is below..this is a stripped down version.
> public class KeyFeatures : System.Web.UI.UserControl
> {
> protected System.Web.UI.WebControls.Label lblInnerHtml;
> public string InnerHtml
> {
> set
> {
> lblInnerHtml.Text = value;
> }
> }
>
>
>
>
>

Set a default property in a user control?

I'm not even sure if what I'm doing is possible. I created a simple control that will be reused throughout the site. It will accept a large amount of HTML with bulleted lists, et

I want to implement like

<uc1:KeyFeatures id="KeyFeatures1" runat="server"
Large amount of Inner Html content goes here between tags..
</uc1:KeyFeatures

Not like

<uc1:KeyFeatures id="KeyFeatures1" runat="server" InnerHtml="Large amount of Inner Html content goes here between tags..."></uc1:KeyFeatures

Can I do it this way? If so, is this considered the 'default' property and how do I declare this in my uc so it accepts the text between the tags?

The code is below..this is a stripped down version.

public class KeyFeatures : System.Web.UI.UserContro

protected System.Web.UI.WebControls.Label lblInnerHtml

public string InnerHtml

se

lblInnerHtml.Text = value
If you find can you please tell here how you do?
Iyigun

"Dave" <anonymous@.discussions.microsoft.com> wrote in message
news:243F1108-1CB3-4F93-8386-BE39FC3601CA@.microsoft.com...
> I'm not even sure if what I'm doing is possible. I created a simple
control that will be reused throughout the site. It will accept a large
amount of HTML with bulleted lists, etc
> I want to implement like:
> <uc1:KeyFeatures id="KeyFeatures1" runat="server">
> Large amount of Inner Html content goes here between tags...
> </uc1:KeyFeatures>
> Not like:
> <uc1:KeyFeatures id="KeyFeatures1" runat="server" InnerHtml="Large amount
of Inner Html content goes here between tags..."></uc1:KeyFeatures>
> Can I do it this way? If so, is this considered the 'default' property and
how do I declare this in my uc so it accepts the text between the tags?
> The code is below..this is a stripped down version.
> public class KeyFeatures : System.Web.UI.UserControl
> {
> protected System.Web.UI.WebControls.Label lblInnerHtml;
> public string InnerHtml
> {
> set
> {
> lblInnerHtml.Text = value;
> }
> }
>
>
>

set a date value

Dear sir,
We are on the w of 27 in year 2004. So this w is "2004-27", last w
is "2004-26",
My question is how can I get the first sunday of w "2004-26", how can I
change string "2004-26" into a DateTime variable with the value of first
sunday of w 2004-26?
Kind regards
Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.comThe easiest way I could think of would be to check what the first day of the
year is (1/1/2004) through the DayOfW property of the DateTime class and
calculate the offset between it and the previous Sunday.
For 2004, calling DateTime.DayOfW for 1/1/2004 would return Thursday.
Therefore, the first w of 2004 (by w numbers) started on Sunday,
12/28/2003. To determine the Sunday starting any given w during 2004 you
could simply calculate it via:
public DateTime GetWStart(int WNumber)
{
return FirstSundayOfYear.AddDays(7*(WNumber-1));
}
The rationale for (WNumber-1) is that the FirstSundayOfYear would already
be set to 12/28/2003 so if you were looking for w 1 then you would want
to add 0 days as opposed to 7.
You indicated that you wanted to convert a string (2004-26) into a DateTime
for the first sunday of each w. What I would probably do in this
scenario since obviously no direct conversion exists would be to define a
WDictionary class derived from System.Collections.DictionaryBase and set
the key of the key to the desired string and the value to the appropriate
DateTime value.
Hope this helps!
"Guoqi Zheng" <no@.sorry.nl> wrote in message
news:uIdNKvDXEHA.128@.TK2MSFTNGP10.phx.gbl...
> Dear sir,
> We are on the w of 27 in year 2004. So this w is "2004-27", last
w
> is "2004-26",
> My question is how can I get the first sunday of w "2004-26", how can I
> change string "2004-26" into a DateTime variable with the value of first
> sunday of w 2004-26?
> --
> Kind regards
> Guoqi Zheng
> guoqi AT meetholland dot com
> Http://www.meetholland.com
>
>

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 a icon to a web application

Hi,
I would like to set an different icon, than explorer icon, to my web
application. When we visit a web page, usually in address bar appears IE
icon before the address. What I want is to substitute that icon to another,
like happens when we visit, for example, http://www.codeproject.com .
How can I do that?
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
rucai dont see any difference for www.codeproject.com
Av.
"ruca" <ruuca@.iol.pt> wrote in message
news:%23pGQAYvREHA.3420@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I would like to set an different icon, than explorer icon, to my web
> application. When we visit a web page, usually in address bar appears IE
> icon before the address. What I want is to substitute that icon to
> another,
> like happens when we visit, for example, http://www.codeproject.com .
> How can I do that?
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
>
Hi Ruca,
Do you mean the favorite.ico have a look for that on Google.
Cor
Try something like
<link rel="icon" href="http://links.10026.com/?link=/favicon.ico" type="image/ico">
"ruca" <ruuca@.iol.pt> wrote in message
news:%23pGQAYvREHA.3420@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I would like to set an different icon, than explorer icon, to my web
> application. When we visit a web page, usually in address bar appears IE
> icon before the address. What I want is to substitute that icon to
another,
> like happens when we visit, for example, http://www.codeproject.com .
> How can I do that?
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
>
ruca wrote:
> Hi,
> I would like to set an different icon, than explorer icon, to my web
> application. When we visit a web page, usually in address bar appears
> IE icon before the address. What I want is to substitute that icon to
> another, like happens when we visit, for example,
> http://www.codeproject.com .
> How can I do that?
This has nothing to do with ASP.NET, it's just a feature in Internet
Explorer.
You only have to provide an icon with a specific format and name
in the root of your website.
For more information, do a Google search for "favicon".
Jos
Hi
http://www.favicon.com/
Best Regards
Vidar Petursson
==============================
Microsoft Visual: Scripting MVP 2000-2004
http://www.icysoft.com/
http://www.deus-x.com/ Instant e-commerce
http://www.microsoft.com/technet/scriptcenter/
Playground: http://213.190.104.211/ ( IE 5.5+ only )
No matter where you go there you are
==============================
"ruca" <ruuca@.iol.pt> wrote in message
news:%23pGQAYvREHA.3420@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I would like to set an different icon, than explorer icon, to my web
> application. When we visit a web page, usually in address bar appears IE
> icon before the address. What I want is to substitute that icon to
> another,
> like happens when we visit, for example, http://www.codeproject.com .
> How can I do that?
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
>
Yes, that's it.
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
"Cor Ligthert" <notfirstname@.planet.nl> escreveu na mensagem
news:eZp2EnvREHA.1388@.TK2MSFTNGP09.phx.gbl...
> Hi Ruca,
> Do you mean the favorite.ico have a look for that on Google.
> Cor
>
I think that this don't work very well with IE 6.0
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
"Cor Ligthert" <notfirstname@.planet.nl> escreveu na mensagem
news:eZp2EnvREHA.1388@.TK2MSFTNGP09.phx.gbl...
> Hi Ruca,
> Do you mean the favorite.ico have a look for that on Google.
> Cor
>
Hi Ruca,
You are right, when you delete the cache from IE 6.0 it is gone. However
that is in my opinion an IE bug. It is with all favicons. I thought that in
Mozilla and Netscape it stays.
I made a mistake it has to be favicon instead of favorite as others wrote,
sorry for that.
Cor
"Cor Ligthert" <notfirstname@.planet.nl> wrote in message news:upVR1h8REHA.3840@.TK2MSFTNGP09
.phx.gbl...
> Hi Ruca,
> You are right, when you delete the cache from IE 6.0 it is gone. However
> that is in my opinion an IE bug. It is with all favicons. I thought that i
n
> Mozilla and Netscape it stays.
> I made a mistake it has to be favicon instead of favorite as others wrote,
> sorry for that.
> Cor
>
A tip: look for the utility FavOrg, it downloads all favicons for your
favorites and preserves them outside of the browsercache.
Hans Kesting

Set a icon to a web application

Hi,

I would like to set an different icon, than explorer icon, to my web
application. When we visit a web page, usually in address bar appears IE
icon before the address. What I want is to substitute that icon to another,
like happens when we visit, for example, http://www.codeproject.com .
How can I do that?

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
rucai dont see any difference for www.codeproject.com

Av.
"ruca" <ruuca@.iol.pt> wrote in message
news:%23pGQAYvREHA.3420@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I would like to set an different icon, than explorer icon, to my web
> application. When we visit a web page, usually in address bar appears IE
> icon before the address. What I want is to substitute that icon to
> another,
> like happens when we visit, for example, http://www.codeproject.com .
> How can I do that?
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
Hi Ruca,

Do you mean the favorite.ico have a look for that on Google.

Cor
Try something like

<link rel="icon" href="http://links.10026.com/?link=/favicon.ico" type="image/ico"
"ruca" <ruuca@.iol.pt> wrote in message
news:%23pGQAYvREHA.3420@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I would like to set an different icon, than explorer icon, to my web
> application. When we visit a web page, usually in address bar appears IE
> icon before the address. What I want is to substitute that icon to
another,
> like happens when we visit, for example, http://www.codeproject.com .
> How can I do that?
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
ruca wrote:
> Hi,
> I would like to set an different icon, than explorer icon, to my web
> application. When we visit a web page, usually in address bar appears
> IE icon before the address. What I want is to substitute that icon to
> another, like happens when we visit, for example,
> http://www.codeproject.com .
> How can I do that?

This has nothing to do with ASP.NET, it's just a feature in Internet
Explorer.

You only have to provide an icon with a specific format and name
in the root of your website.

For more information, do a Google search for "favicon".

--

Jos
Hi

http://www.favicon.com/

--
Best Regards
Vidar Petursson
==============================
Microsoft Visual: Scripting MVP 2000-2004
http://www.icysoft.com/
http://www.deus-x.com/ Instant e-commerce
http://www.microsoft.com/technet/scriptcenter/
Playground: http://213.190.104.211/ ( IE 5.5+ only )

No matter where you go there you are
==============================
"ruca" <ruuca@.iol.pt> wrote in message
news:%23pGQAYvREHA.3420@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I would like to set an different icon, than explorer icon, to my web
> application. When we visit a web page, usually in address bar appears IE
> icon before the address. What I want is to substitute that icon to
> another,
> like happens when we visit, for example, http://www.codeproject.com .
> How can I do that?
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
Yes, that's it.

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Cor Ligthert" <notfirstname@.planet.nl> escreveu na mensagem
news:eZp2EnvREHA.1388@.TK2MSFTNGP09.phx.gbl...
> Hi Ruca,
> Do you mean the favorite.ico have a look for that on Google.
> Cor
I think that this don't work very well with IE 6.0

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Cor Ligthert" <notfirstname@.planet.nl> escreveu na mensagem
news:eZp2EnvREHA.1388@.TK2MSFTNGP09.phx.gbl...
> Hi Ruca,
> Do you mean the favorite.ico have a look for that on Google.
> Cor
Hi Ruca,

You are right, when you delete the cache from IE 6.0 it is gone. However
that is in my opinion an IE bug. It is with all favicons. I thought that in
Mozilla and Netscape it stays.

I made a mistake it has to be favicon instead of favorite as others wrote,
sorry for that.

Cor
"Cor Ligthert" <notfirstname@.planet.nl> wrote in message news:upVR1h8REHA.3840@.TK2MSFTNGP09.phx.gbl...
> Hi Ruca,
> You are right, when you delete the cache from IE 6.0 it is gone. However
> that is in my opinion an IE bug. It is with all favicons. I thought that in
> Mozilla and Netscape it stays.
> I made a mistake it has to be favicon instead of favorite as others wrote,
> sorry for that.
> Cor

A tip: look for the utility FavOrg, it downloads all favicons for your
favorites and preserves them outside of the browsercache.

Hans Kesting
In article <uv0VIfvREHA.3348@.TK2MSFTNGP09.phx.gbl>, avn@.newsgroups.com
says...
> i dont see any difference for www.codeproject.com
> Av.
> "ruca" <ruuca@.iol.pt> wrote in message
> news:%23pGQAYvREHA.3420@.TK2MSFTNGP11.phx.gbl...
> > Hi,
> > I would like to set an different icon, than explorer icon, to my web
> > application. When we visit a web page, usually in address bar appears IE
> > icon before the address. What I want is to substitute that icon to
> > another,
> > like happens when we visit, for example, http://www.codeproject.com .
> > How can I do that?
> > --
> > Programming ASP.NET with VB.NET
> > Thank's (if you try to help me)
> > Hope this help you (if I try to help you)
> > ruca
>
It works find in Opera and Mozila. IE has not caught up!

Set a hyperlink to open in window.

how do you set a hyperlink to open the link in a new window/browser, so I dont lose my current place in the site.

you have to do this with client code

<a href="http://links.10026.com/?link=blah" TARGET="_new"...>

the "_new" is a name you assign to a window. Use that with more then one call and they will reuse the window.

You can't specify the window (new or otherwise) with a Response.Redirect() or any other server call, sorry...


If you need to do this in the code behind and not in the HTML you can use this syntax:

Me.ClientScript.RegisterClientScriptBlock(Me.GetType,"open","<script language=javascript>window.open('http://www.yourpage.aspx');</script>")


Simply the below code

<a href="http://links.10026.com/?link=WebForm1.aspx" target="_blank">Open new window</a>

HC


As everybody as already said

<a href="http://links.10026.com/?link=URL" target="_blank>Clicking on this opens a new window</a>

however if you are using hyperlink button in asp.net then

<asp:HyperLinkid="value"Runat="Server"
ImageUrl="url"
NavigateUrl="url"
Target="_blank|_self|_top|_parent|framename"
Text="string"
property="value"
Style="CSS style settings..."
/>

you can choose target=_blank as described.

Hope that helps and good luck

Set A Parameter Without Redirecting A Page?

can somebody tell me how to set a parameter of my current URL

without using response.redirect?

I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?

also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?

thanks!Querystring parameters cannot be reset dynamically as they represent a
read-only collection of items in the url.

Of course, something else you could do would be to have a series of local
variables or protected properties that would initially populate from this
list, then change the variable in postback. This would work nicely if you're
using AJAX because then you wouldn't be posting back the whole page. If
you're not using AJAX, then using a response.redirect doesn't effect you
much because you'll have a full page postback and might as well do the
redirect to avoid worrying about keeping parameter updates in a viewstate.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"pbd22" <dushkin@.gmail.comwrote in message
news:1167335417.354465.213040@.n51g2000cwc.googlegr oups.com...

Quote:

Originally Posted by

can somebody tell me how to set a parameter of my current URL
>
without using response.redirect?
>
I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?
>
also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?
>
thanks!
>


ok, thanks mark.

i dont think this will work as the updated parameter is created in a
while
loop that outputs many values - this is a count.

what i have done is pass my url querystring through a hidden iframe
from
the referring page (i am uploading files). now, what i want to do is
send a
count back to the referring page (the count represents upload time). i
thought i might be able to do this in the querystring but this would
cause
numerous postbacks in sequence - not pretty.

since it looks like doing it via the querystring is a no-go, do you
have any ideas how
i might send the upload count back to the referring page? is it
possible to send an ajax response from the server when the client does
not initiate the call?

thanks.
peter

Mark Fitzpatrick wrote:

Quote:

Originally Posted by

Querystring parameters cannot be reset dynamically as they represent a
read-only collection of items in the url.
>
Of course, something else you could do would be to have a series of local
variables or protected properties that would initially populate from this
list, then change the variable in postback. This would work nicely if you're
using AJAX because then you wouldn't be posting back the whole page. If
you're not using AJAX, then using a response.redirect doesn't effect you
much because you'll have a full page postback and might as well do the
redirect to avoid worrying about keeping parameter updates in a viewstate.
>
>
--
>
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
>
>
>
"pbd22" <dushkin@.gmail.comwrote in message
news:1167335417.354465.213040@.n51g2000cwc.googlegr oups.com...

Quote:

Originally Posted by

can somebody tell me how to set a parameter of my current URL

without using response.redirect?

I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?

also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?

thanks!

Set a session variable to pre defined value

I just want to set a sesison variable to a defined value when a page loads, I've tried the following but it doesn't seem to work. Any ideas where I'm going wrong?

<%# Session("var1") = "abc" %
Thanks

Julian ParkinsonYou've used adata binding expression, so it will only be called when DataBind() is called on the Page.

I think you want to use aninline code expression instead:

<% Session("var1") = "abc" %>

Hi,

You need to put the Session variable in the Page_Load like this:


if(!Page.IsPostBack)
{

Session["Name"] = "NewValue";
Response.Redirect("Mynewpage.aspx");

}

And then in the Mynewpage.aspx you can recieve the session using this code in the Page_Load with not postback.

if(Session["Name"] == null )
Response.Redirect("LoginPage.aspx");

else
Label1.Text = Session["Name"].ToString();


Dan,

Cheers for that. I just needed the remove the hash!! Duhh!

I'm moving from asp vb to asp.net vb and i'm finding it strange, some stuff is the same, some isn't sometimes I can't see the wood for the trees.

Thanks again.

Set a separator image for a SiteMapPath (skin)

In a ASP.NET 2.0 project I'd like to set an image as path separator in
the SiteMapPath. When I edit the PathSepartor template (for this
SiteMapPath) and drag an image on it, it works fine for all pages in
the root of the Web project. VS2005 creates the folling aspx:
<asp:SiteMapPath ID="SiteMapPath" runat="server">
<PathSeparatorTemplate>
<img src="http://pics.10026.com/?src=Images/arrow-right.jpg" />
</PathSeparatorTemplate>
</asp:SiteMapPath>
However, this project also has pages in subfolders. For all pages in
these subfolers this images reference doesn't work anymore (logical
behavirour). So I changed the img src to "~/Images/arrow-right.jpg" as
shown below:
<asp:SiteMapPath ID="SiteMapPath" runat="server">
<PathSeparatorTemplate>
<img src="http://pics.10026.com/?src=~/Images/arrow-right.jpg" />
</PathSeparatorTemplate>
</asp:SiteMapPath>
This results in not showing the arrow image at all. Even not in the
pages in the root of the webproject. The image properties in the
website state: "http://localhost/project/~/Images/arrow-right.jpg".
Other options I tried where "../" and "./". None of them seem to work.
Does somebody has a solution to this problem? Is it a bug?
Kind regards,
Jules
BTW: The behaviour as described above also occurs when I set this
SiteMap style in a .skin file in the App_Thems.Mark your <img> with runat=server
-Brock
http://staff.develop.com/ballen

> In a ASP.NET 2.0 project I'd like to set an image as path separator in
> the SiteMapPath. When I edit the PathSepartor template (for this
> SiteMapPath) and drag an image on it, it works fine for all pages in
> the root of the Web project. VS2005 creates the folling aspx:
> <asp:SiteMapPath ID="SiteMapPath" runat="server">
> <PathSeparatorTemplate>
> <img src="http://pics.10026.com/?src=Images/arrow-right.jpg" />
> </PathSeparatorTemplate>
> </asp:SiteMapPath>
> However, this project also has pages in subfolders. For all pages in
> these subfolers this images reference doesn't work anymore (logical
> behavirour). So I changed the img src to "~/Images/arrow-right.jpg" as
> shown below:
> <asp:SiteMapPath ID="SiteMapPath" runat="server">
> <PathSeparatorTemplate>
> <img src="http://pics.10026.com/?src=~/Images/arrow-right.jpg" />
> </PathSeparatorTemplate>
> </asp:SiteMapPath>
> This results in not showing the arrow image at all. Even not in the
> pages in the root of the webproject. The image properties in the
> website state: "http://localhost/project/~/Images/arrow-right.jpg".
> Other options I tried where "../" and "./". None of them seem to work.
> Does somebody has a solution to this problem? Is it a bug?
> Kind regards,
> Jules
> BTW: The behaviour as described above also occurs when I set this
> SiteMap style in a .skin file in the App_Thems.
>

Set a separator image for a SiteMapPath (skin)

In a ASP.NET 2.0 project I'd like to set an image as path separator in
the SiteMapPath. When I edit the PathSepartor template (for this
SiteMapPath) and drag an image on it, it works fine for all pages in
the root of the Web project. VS2005 creates the folling aspx:

<asp:SiteMapPath ID="SiteMapPath" runat="server">
<PathSeparatorTemplate>
<img src="http://pics.10026.com/?src=Images/arrow-right.jpg" />
</PathSeparatorTemplate>
</asp:SiteMapPath
However, this project also has pages in subfolders. For all pages in
these subfolers this images reference doesn't work anymore (logical
behavirour). So I changed the img src to "~/Images/arrow-right.jpg" as
shown below:

<asp:SiteMapPath ID="SiteMapPath" runat="server">
<PathSeparatorTemplate>
<img src="http://pics.10026.com/?src=~/Images/arrow-right.jpg" />
</PathSeparatorTemplate>
</asp:SiteMapPath
This results in not showing the arrow image at all. Even not in the
pages in the root of the webproject. The image properties in the
website state: "http://localhost/project/~/Images/arrow-right.jpg".
Other options I tried where "../" and "./". None of them seem to work.
Does somebody has a solution to this problem? Is it a bug?

Kind regards,

Jules

BTW: The behaviour as described above also occurs when I set this
SiteMap style in a .skin file in the App_Thems.Mark your <img> with runat=server

-Brock
http://staff.develop.com/ballen

> In a ASP.NET 2.0 project I'd like to set an image as path separator in
> the SiteMapPath. When I edit the PathSepartor template (for this
> SiteMapPath) and drag an image on it, it works fine for all pages in
> the root of the Web project. VS2005 creates the folling aspx:
> <asp:SiteMapPath ID="SiteMapPath" runat="server">
> <PathSeparatorTemplate>
> <img src="http://pics.10026.com/?src=Images/arrow-right.jpg" />
> </PathSeparatorTemplate>
> </asp:SiteMapPath>
> However, this project also has pages in subfolders. For all pages in
> these subfolers this images reference doesn't work anymore (logical
> behavirour). So I changed the img src to "~/Images/arrow-right.jpg" as
> shown below:
> <asp:SiteMapPath ID="SiteMapPath" runat="server">
> <PathSeparatorTemplate>
> <img src="http://pics.10026.com/?src=~/Images/arrow-right.jpg" />
> </PathSeparatorTemplate>
> </asp:SiteMapPath>
> This results in not showing the arrow image at all. Even not in the
> pages in the root of the webproject. The image properties in the
> website state: "http://localhost/project/~/Images/arrow-right.jpg".
> Other options I tried where "../" and "./". None of them seem to work.
> Does somebody has a solution to this problem? Is it a bug?
> Kind regards,
> Jules
> BTW: The behaviour as described above also occurs when I set this
> SiteMap style in a .skin file in the App_Thems.

Set a value to a hidden field in a web page

Hello!
I have a problem when using a hidden field to send a value to the server.
Below you can see my code in simplyfied versions.
What I'm trying to do is:
1. The user browses for a picture at the network from their computer using
control File1.
2. The user clickes the button Commit picture (with id CliBtn)
a. The script is running at the client to get the sharename of the file
selected
b. The script should update a picture shown (the code below just shows
the label with the path)
c. The code-behind should then save all values in a database.
The problem appear when I'm trying to set the value to the hide control, so
I am doing something wrong.
I'm not so used to web developing, so please give me some help here, with
code please.
Regards Magnus
--
Code-behind page in C#
--
void Page_Load(object sender, EventArgs e)
{
HtmlInputHidden hide = new HtmlInputHidden();
hide.ID = "hide";
hide.Value = "Hidden Text";
sURL = Request.Form["hide"].ToString();
Label11.Text = sURL;
}
--
.ASPX page
--
<head>
<title>Untitled Page</title>
<script language=vbscript>
function getpicvb()
dim javatext
javatext = document.getElementById("File1").getAttribute("value")
dim fso
set FSO = CreateObject("Scripting.FileSystemObject")
dim drive
set drive =
FSO.GetDrive(FSO.GetDriveName(FSO.GetAbsolutePathName(javatext)))
javatext = drive.ShareName
'hide.value = javatext ' this row doesn't work
alert(javatext)
end function
</script>
</head>
<body>
<input id="File1" type="file" />
<input id="CliBtn" value="Commit picture" onclick="getpicvb() " type=submit
/>
<asp:Label ID="Label11" Runat="server" Text="Label"></asp:Label>
<input type=hidden id=hide />
</body>
----
---
"Brock Allen" <ballen@dotnet.itags.org.NOSPAMdevelop.com> wrote in message
news:444437632489320772241920@dotnet.itags.org.msnews.microsoft.com...
> Make a hidden field (via Page.RegisterHiddenField) and have the javascript
> write the value to the hidden. In the server, fetch the value via
Request.Form["YourFieldID"]
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
>Controlled envionement ? What is the exact problme you have (you have always
"Hidden Text" server side ?
In particular fso is not supposed to work without tweaking security
settings. ARe you sure itjust doesn't fails silently...
Also you always change the value of the "hide" field when the page loads...
Try to do not "if (!Ispostback)"...
Patrice
"Magnus Blomberg" <magnus.blomberg@.skanska.se> a crit dans le message de
news:uTXsgPOQFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hello!
> I have a problem when using a hidden field to send a value to the server.
> Below you can see my code in simplyfied versions.
> What I'm trying to do is:
> 1. The user browses for a picture at the network from their computer using
> control File1.
> 2. The user clickes the button Commit picture (with id CliBtn)
> a. The script is running at the client to get the sharename of the
file
> selected
> b. The script should update a picture shown (the code below just shows
> the label with the path)
> c. The code-behind should then save all values in a database.
> The problem appear when I'm trying to set the value to the hide control,
so
> I am doing something wrong.
> I'm not so used to web developing, so please give me some help here, with
> code please.
> Regards Magnus
> --
> Code-behind page in C#
> --
> void Page_Load(object sender, EventArgs e)
> {
> HtmlInputHidden hide = new HtmlInputHidden();
> hide.ID = "hide";
> hide.Value = "Hidden Text";
> sURL = Request.Form["hide"].ToString();
> Label11.Text = sURL;
> }
> --
> .ASPX page
> --
> <head>
> <title>Untitled Page</title>
> <script language=vbscript>
> function getpicvb()
> dim javatext
> javatext = document.getElementById("File1").getAttribute("value")
> dim fso
> set FSO = CreateObject("Scripting.FileSystemObject")
> dim drive
> set drive =
> FSO.GetDrive(FSO.GetDriveName(FSO.GetAbsolutePathName(javatext)))
> javatext = drive.ShareName
> 'hide.value = javatext ' this row doesn't work
> alert(javatext)
> end function
> </script>
> </head>
> <body>
> <input id="File1" type="file" />
> <input id="CliBtn" value="Commit picture" onclick="getpicvb() "
type=submit
> />
> <asp:Label ID="Label11" Runat="server" Text="Label"></asp:Label>
> <input type=hidden id=hide />
> </body>
> ----
--
> ---
> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> news:444437632489320772241920@.msnews.microsoft.com...
javascript
> Request.Form["YourFieldID"]
>
>
Magnus what are u trying to do'
Vbscript,C#'?
*** Sent via Developersdex http://www.examnotes.net ***
Hello and thanks for your answer.
Well, I thought fso was not a common way to solve this, but since this is
for a Intranet, I think I can theak the security anyway. If you have a
better solution for this issue I'll be glad to here it.
I'm not sure what silent failure does mean, but I think that is what I get.
I get no error message, but the alert row is never executed when the
hide.value = javatext is run.
The problem does not appear when working with fso. It appears when trying to
set the hide object.
I am familiar to the (!IsPostBack) command, so I will take care of that in
my full code.
My code in this forum is shrinked.
Regards Magnus
"Patrice" <nobody@.nowhere.com> wrote in message
news:#Xio4aOQFHA.3076@.TK2MSFTNGP14.phx.gbl...
> Controlled envionement ? What is the exact problme you have (you have
always
> "Hidden Text" server side ?
> In particular fso is not supposed to work without tweaking security
> settings. ARe you sure itjust doesn't fails silently...
> Also you always change the value of the "hide" field when the page
loads...
> Try to do not "if (!Ispostback)"...
> Patrice
> --
> "Magnus Blomberg" <magnus.blomberg@.skanska.se> a crit dans le message de
> news:uTXsgPOQFHA.1528@.TK2MSFTNGP09.phx.gbl...
server.
using
> file
shows
> so
with
document.getElementById("File1").getAttribute("value")
> type=submit
> ----
> --
> javascript
This
basics?
>
Ok, so this line is never executed.
Check if the fso object is set. Do you have yet tweaked security ?
If I remember when security is not tweaked , it fails without any warning
(as anyway it 's not supposed to work).
What do you want to do ? You can use an input type=file to get the name
server side even if you don't want to upload this file. This way you
wouldn't need to copy this value in an hidden field.
Also I don't really see how it works. The server could perhaps not have the
same netwrok path available.
Depneidng on what you wan to do with this file, I would upload it server
file to do the intended processing...
Good luck
Patrice
"Magnus Blomberg" <magnus.blomberg@.skanska.se> a crit dans le message de
news:%23GCvfKPQFHA.3988@.tk2msftngp13.phx.gbl...
> Hello and thanks for your answer.
> Well, I thought fso was not a common way to solve this, but since this is
> for a Intranet, I think I can theak the security anyway. If you have a
> better solution for this issue I'll be glad to here it.
> I'm not sure what silent failure does mean, but I think that is what I
get.
> I get no error message, but the alert row is never executed when the
> hide.value = javatext is run.
> The problem does not appear when working with fso. It appears when trying
to
> set the hide object.
> I am familiar to the (!IsPostBack) command, so I will take care of that in
> my full code.
> My code in this forum is shrinked.
> Regards Magnus
>
> "Patrice" <nobody@.nowhere.com> wrote in message
> news:#Xio4aOQFHA.3076@.TK2MSFTNGP14.phx.gbl...
> always
> loads...
de
> server.
> using
> shows
control,
> with
> document.getElementById("File1").getAttribute("value")
> ----
> This
> basics?
>

Set a value to a hidden field in a web page

Hello!

I have a problem when using a hidden field to send a value to the server.
Below you can see my code in simplyfied versions.

What I'm trying to do is:
1. The user browses for a picture at the network from their computer using
control File1.
2. The user clickes the button Commit picture (with id CliBtn)
a. The script is running at the client to get the sharename of the file
selected
b. The script should update a picture shown (the code below just shows
the label with the path)
c. The code-behind should then save all values in a database.

The problem appear when I'm trying to set the value to the hide control, so
I am doing something wrong.
I'm not so used to web developing, so please give me some help here, with
code please.

Regards Magnus
--------
Code-behind page in C#
--------
void Page_Load(object sender, EventArgs e)
{
HtmlInputHidden hide = new HtmlInputHidden();
hide.ID = "hide";
hide.Value = "Hidden Text";
sURL = Request.Form["hide"].ToString();
Label11.Text = sURL;
}
--------
..ASPX page
--------
<head>
<title>Untitled Page</title>
<script language=vbscript>
function getpicvb()
dim javatext
javatext = document.getElementById("File1").getAttribute("value")
dim fso
set FSO = CreateObject("Scripting.FileSystemObject")
dim drive
set drive =
FSO.GetDrive(FSO.GetDriveName(FSO.GetAbsolutePathN ame(javatext)))
javatext = drive.ShareName
'hide.value = javatext ' this row doesn't work
alert(javatext)
end function
</script>
</head>
<body>
<input id="File1" type="file" />
<input id="CliBtn" value="Commit picture" onclick="getpicvb() " type=submit
/>
<asp:Label ID="Label11" Runat="server" Text="Label"></asp:Label>
<input type=hidden id=hide />
</body>
-----------------------
---------------
"Brock Allen" <ballen@dotnet.itags.org.NOSPAMdevelop.com> wrote in message
news:444437632489320772241920@dotnet.itags.org.msnews.microsoft.com ...
> Make a hidden field (via Page.RegisterHiddenField) and have the javascript
> write the value to the hidden. In the server, fetch the value via
Request.Form["YourFieldID"]
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
> > Hello!
> > I have a client javascript that generates a string (like below). This
> > string should then be used by server code (in this case a function
> > called run).
> > <script language=javascript>
> > function getpic()
> > { string s;
> > s = document.getElementById("File1").getAttribute("value");
> > <% run(s); %>
> > }
> > I think this would be rather common, so maybe I'm missing some basics?
> > Regards MagnusControlled envionement ? What is the exact problme you have (you have always
"Hidden Text" server side ?

In particular fso is not supposed to work without tweaking security
settings. ARe you sure itjust doesn't fails silently...
Also you always change the value of the "hide" field when the page loads...
Try to do not "if (!Ispostback)"...

Patrice

--

"Magnus Blomberg" <magnus.blomberg@.skanska.se> a crit dans le message de
news:uTXsgPOQFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hello!
> I have a problem when using a hidden field to send a value to the server.
> Below you can see my code in simplyfied versions.
> What I'm trying to do is:
> 1. The user browses for a picture at the network from their computer using
> control File1.
> 2. The user clickes the button Commit picture (with id CliBtn)
> a. The script is running at the client to get the sharename of the
file
> selected
> b. The script should update a picture shown (the code below just shows
> the label with the path)
> c. The code-behind should then save all values in a database.
> The problem appear when I'm trying to set the value to the hide control,
so
> I am doing something wrong.
> I'm not so used to web developing, so please give me some help here, with
> code please.
> Regards Magnus
> --------
> Code-behind page in C#
> --------
> void Page_Load(object sender, EventArgs e)
> {
> HtmlInputHidden hide = new HtmlInputHidden();
> hide.ID = "hide";
> hide.Value = "Hidden Text";
> sURL = Request.Form["hide"].ToString();
> Label11.Text = sURL;
> }
> --------
> .ASPX page
> --------
> <head>
> <title>Untitled Page</title>
> <script language=vbscript>
> function getpicvb()
> dim javatext
> javatext = document.getElementById("File1").getAttribute("value")
> dim fso
> set FSO = CreateObject("Scripting.FileSystemObject")
> dim drive
> set drive =
> FSO.GetDrive(FSO.GetDriveName(FSO.GetAbsolutePathN ame(javatext)))
> javatext = drive.ShareName
> 'hide.value = javatext ' this row doesn't work
> alert(javatext)
> end function
> </script>
> </head>
> <body>
> <input id="File1" type="file" />
> <input id="CliBtn" value="Commit picture" onclick="getpicvb() "
type=submit
> />
> <asp:Label ID="Label11" Runat="server" Text="Label"></asp:Label>
> <input type=hidden id=hide />
> </body>
> -----------------------
--
> ---------------
> "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> news:444437632489320772241920@.msnews.microsoft.com ...
> > Make a hidden field (via Page.RegisterHiddenField) and have the
javascript
> > write the value to the hidden. In the server, fetch the value via
> Request.Form["YourFieldID"]
> > -Brock
> > DevelopMentor
> > http://staff.develop.com/ballen
> > > Hello!
> > > > I have a client javascript that generates a string (like below). This
> > > string should then be used by server code (in this case a function
> > > called run).
> > > > <script language=javascript>
> > > function getpic()
> > > { string s;
> > > s = document.getElementById("File1").getAttribute("value");
> > > <% run(s); %>
> > > }
> > > I think this would be rather common, so maybe I'm missing some basics?
> > > Regards Magnus
>
Magnus what are u trying to do??
Vbscript,C#???

*** Sent via Developersdex http://www.developersdex.com ***
Hello and thanks for your answer.
Well, I thought fso was not a common way to solve this, but since this is
for a Intranet, I think I can theak the security anyway. If you have a
better solution for this issue I'll be glad to here it.
I'm not sure what silent failure does mean, but I think that is what I get.
I get no error message, but the alert row is never executed when the
hide.value = javatext is run.

The problem does not appear when working with fso. It appears when trying to
set the hide object.

I am familiar to the (!IsPostBack) command, so I will take care of that in
my full code.
My code in this forum is shrinked.

Regards Magnus

"Patrice" <nobody@.nowhere.com> wrote in message
news:#Xio4aOQFHA.3076@.TK2MSFTNGP14.phx.gbl...
> Controlled envionement ? What is the exact problme you have (you have
always
> "Hidden Text" server side ?
> In particular fso is not supposed to work without tweaking security
> settings. ARe you sure itjust doesn't fails silently...
> Also you always change the value of the "hide" field when the page
loads...
> Try to do not "if (!Ispostback)"...
> Patrice
> --
> "Magnus Blomberg" <magnus.blomberg@.skanska.se> a crit dans le message de
> news:uTXsgPOQFHA.1528@.TK2MSFTNGP09.phx.gbl...
> > Hello!
> > I have a problem when using a hidden field to send a value to the
server.
> > Below you can see my code in simplyfied versions.
> > What I'm trying to do is:
> > 1. The user browses for a picture at the network from their computer
using
> > control File1.
> > 2. The user clickes the button Commit picture (with id CliBtn)
> > a. The script is running at the client to get the sharename of the
> file
> > selected
> > b. The script should update a picture shown (the code below just
shows
> > the label with the path)
> > c. The code-behind should then save all values in a database.
> > The problem appear when I'm trying to set the value to the hide control,
> so
> > I am doing something wrong.
> > I'm not so used to web developing, so please give me some help here,
with
> > code please.
> > Regards Magnus
> > --------
> > Code-behind page in C#
> > --------
> > void Page_Load(object sender, EventArgs e)
> > {
> > HtmlInputHidden hide = new HtmlInputHidden();
> > hide.ID = "hide";
> > hide.Value = "Hidden Text";
> > sURL = Request.Form["hide"].ToString();
> > Label11.Text = sURL;
> > }
> > --------
> > .ASPX page
> > --------
> > <head>
> > <title>Untitled Page</title>
> > <script language=vbscript>
> > function getpicvb()
> > dim javatext
> > javatext =
document.getElementById("File1").getAttribute("value")
> > dim fso
> > set FSO = CreateObject("Scripting.FileSystemObject")
> > dim drive
> > set drive =
> > FSO.GetDrive(FSO.GetDriveName(FSO.GetAbsolutePathN ame(javatext)))
> > javatext = drive.ShareName
> > 'hide.value = javatext ' this row doesn't work
> > alert(javatext)
> > end function
> > </script>
> > </head>
> > <body>
> > <input id="File1" type="file" />
> > <input id="CliBtn" value="Commit picture" onclick="getpicvb() "
> type=submit
> > />
> > <asp:Label ID="Label11" Runat="server" Text="Label"></asp:Label>
> > <input type=hidden id=hide />
> > </body>
> -----------------------
> --
> > ---------------
> > "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> > news:444437632489320772241920@.msnews.microsoft.com ...
> > > Make a hidden field (via Page.RegisterHiddenField) and have the
> javascript
> > > write the value to the hidden. In the server, fetch the value via
> > Request.Form["YourFieldID"]
> > > > -Brock
> > > DevelopMentor
> > > http://staff.develop.com/ballen
> > > > > > > Hello!
> > > > > > I have a client javascript that generates a string (like below).
This
> > > > string should then be used by server code (in this case a function
> > > > called run).
> > > > > > <script language=javascript>
> > > > function getpic()
> > > > { string s;
> > > > s = document.getElementById("File1").getAttribute("value");
> > > > <% run(s); %>
> > > > }
> > > > I think this would be rather common, so maybe I'm missing some
basics?
> > > > Regards Magnus
> > > > >
Ok, so this line is never executed.

Check if the fso object is set. Do you have yet tweaked security ?

If I remember when security is not tweaked , it fails without any warning
(as anyway it 's not supposed to work).

What do you want to do ? You can use an input type=file to get the name
server side even if you don't want to upload this file. This way you
wouldn't need to copy this value in an hidden field.

Also I don't really see how it works. The server could perhaps not have the
same netwrok path available.

Depneidng on what you wan to do with this file, I would upload it server
file to do the intended processing...

Good luck

Patrice

--

"Magnus Blomberg" <magnus.blomberg@.skanska.se> a crit dans le message de
news:%23GCvfKPQFHA.3988@.tk2msftngp13.phx.gbl...
> Hello and thanks for your answer.
> Well, I thought fso was not a common way to solve this, but since this is
> for a Intranet, I think I can theak the security anyway. If you have a
> better solution for this issue I'll be glad to here it.
> I'm not sure what silent failure does mean, but I think that is what I
get.
> I get no error message, but the alert row is never executed when the
> hide.value = javatext is run.
> The problem does not appear when working with fso. It appears when trying
to
> set the hide object.
> I am familiar to the (!IsPostBack) command, so I will take care of that in
> my full code.
> My code in this forum is shrinked.
> Regards Magnus
>
> "Patrice" <nobody@.nowhere.com> wrote in message
> news:#Xio4aOQFHA.3076@.TK2MSFTNGP14.phx.gbl...
> > Controlled envionement ? What is the exact problme you have (you have
> always
> > "Hidden Text" server side ?
> > In particular fso is not supposed to work without tweaking security
> > settings. ARe you sure itjust doesn't fails silently...
> > Also you always change the value of the "hide" field when the page
> loads...
> > Try to do not "if (!Ispostback)"...
> > Patrice
> > --
> > "Magnus Blomberg" <magnus.blomberg@.skanska.se> a crit dans le message
de
> > news:uTXsgPOQFHA.1528@.TK2MSFTNGP09.phx.gbl...
> > > Hello!
> > > > I have a problem when using a hidden field to send a value to the
> server.
> > > Below you can see my code in simplyfied versions.
> > > > What I'm trying to do is:
> > > 1. The user browses for a picture at the network from their computer
> using
> > > control File1.
> > > 2. The user clickes the button Commit picture (with id CliBtn)
> > > a. The script is running at the client to get the sharename of the
> > file
> > > selected
> > > b. The script should update a picture shown (the code below just
> shows
> > > the label with the path)
> > > c. The code-behind should then save all values in a database.
> > > > The problem appear when I'm trying to set the value to the hide
control,
> > so
> > > I am doing something wrong.
> > > I'm not so used to web developing, so please give me some help here,
> with
> > > code please.
> > > > Regards Magnus
> > > --------
> > > Code-behind page in C#
> > > --------
> > > void Page_Load(object sender, EventArgs e)
> > > {
> > > HtmlInputHidden hide = new HtmlInputHidden();
> > > hide.ID = "hide";
> > > hide.Value = "Hidden Text";
> > > sURL = Request.Form["hide"].ToString();
> > > Label11.Text = sURL;
> > > }
> > > --------
> > > .ASPX page
> > > --------
> > > <head>
> > > <title>Untitled Page</title>
> > > <script language=vbscript>
> > > function getpicvb()
> > > dim javatext
> > > javatext =
> document.getElementById("File1").getAttribute("value")
> > > dim fso
> > > set FSO = CreateObject("Scripting.FileSystemObject")
> > > dim drive
> > > set drive =
> > > FSO.GetDrive(FSO.GetDriveName(FSO.GetAbsolutePathN ame(javatext)))
> > > javatext = drive.ShareName
> > > 'hide.value = javatext ' this row doesn't work
> > > alert(javatext)
> > > end function
> > > </script>
> > > </head>
> > > <body>
> > > <input id="File1" type="file" />
> > > <input id="CliBtn" value="Commit picture" onclick="getpicvb() "
> > type=submit
> > > />
> > > <asp:Label ID="Label11" Runat="server" Text="Label"></asp:Label>
> > > <input type=hidden id=hide />
> > > </body>
> -----------------------
> > --
> > > ---------------
> > > "Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
> > > news:444437632489320772241920@.msnews.microsoft.com ...
> > > > Make a hidden field (via Page.RegisterHiddenField) and have the
> > javascript
> > > > write the value to the hidden. In the server, fetch the value via
> > > Request.Form["YourFieldID"]
> > > > > > -Brock
> > > > DevelopMentor
> > > > http://staff.develop.com/ballen
> > > > > > > > > > > Hello!
> > > > > > > > I have a client javascript that generates a string (like below).
> This
> > > > > string should then be used by server code (in this case a function
> > > > > called run).
> > > > > > > > <script language=javascript>
> > > > > function getpic()
> > > > > { string s;
> > > > > s = document.getElementById("File1").getAttribute("value");
> > > > > <% run(s); %>
> > > > > }
> > > > > I think this would be rather common, so maybe I'm missing some
> basics?
> > > > > Regards Magnus
> > > > > > > > > > > >

set absolute position on panel

How can the absolute position be set when a button is hit. I have a help
pannel that i want to appear next to the "?" button that is selected.
thanks
any ideas would be appreciated
kesset
obj.style.top = x;
obj.style.left = y;
to find the x and y of an object:
window.getYPos = function(obj){
var curtop = 0;
if (document.getElementById || document.all) {
while (obj.offsetParent) {
curtop += obj.offsetTop;
if (typeof(obj.scrollTop) == 'number')
curtop -= obj.scrollTop;
obj = obj.offsetParent;
}
}
else if (document.layers)
curtop += obj.y;
return curtop;
}
window.getXPos = function(obj) {
var curleft = 0;
if (document.getElementById || document.all) {
while (obj.offsetParent) {
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (document.layers)
curleft += obj.x;
return curleft;
}
-- bruce (sqlwork.com)
"Kurt Schroeder" <KurtSchroeder@.discussions.microsoft.com> wrote in message
news:522009E3-7335-4B58-A4E9-28F9C49281E1@.microsoft.com...
> How can the absolute position be set when a button is hit. I have a help
> pannel that i want to appear next to the "?" button that is selected.
> thanks
> any ideas would be appreciated
> kes

set absolute position on panel

How can the absolute position be set when a button is hit. I have a help
pannel that i want to appear next to the "?" button that is selected.

thanks
any ideas would be appreciated
kesset
obj.style.top = x;
obj.style.left = y;

to find the x and y of an object:

window.getYPos = function(obj){
var curtop = 0;
if (document.getElementById || document.all) {
while (obj.offsetParent) {
curtop += obj.offsetTop;
if (typeof(obj.scrollTop) == 'number')
curtop -= obj.scrollTop;
obj = obj.offsetParent;
}
}
else if (document.layers)
curtop += obj.y;
return curtop;
}
window.getXPos = function(obj) {
var curleft = 0;
if (document.getElementById || document.all) {
while (obj.offsetParent) {
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (document.layers)
curleft += obj.x;
return curleft;
}

-- bruce (sqlwork.com)

"Kurt Schroeder" <KurtSchroeder@.discussions.microsoft.com> wrote in message
news:522009E3-7335-4B58-A4E9-28F9C49281E1@.microsoft.com...
> How can the absolute position be set when a button is hit. I have a help
> pannel that i want to appear next to the "?" button that is selected.
> thanks
> any ideas would be appreciated
> kes

Set alternate text to empty string

Hi,

I have found that with both the HtmlImage and the Image that if I set the AlternateText property to string.Empty then the 'alt' tag is omitted from the output img tag.

Is there a way around this? The accessibility checkers demand an alt tag even if its empty. If this is not possible, does anyone know if there's much difference between an lt tag set to empty string and an alt tag set to a single space?

Cheers, WT.

the only real difference between setting an alt tag to " " rather than haveing it string.empty is that if left empty it will take it off the form so that .net does not have to keep up with that tag. It's the same thing if you set it to visible = False it just doen't show up on the form. so ultimately it comes down to speed (an almost imeasurable amount). My suggestion is to leave it with one single space.


Ahh, well actually " " results in a dodgy tool tip being displayed! Adding the 'alt' attribute with 'Control.Attributes.Add()' apears to allow empty string alt tags though.


string.empty return a NULL, and a single space is actually an instance of string. they are totally different.
if you assign string.empty to thebase.Attributes["alt"](as shown below), then that "alt" atrribute is actually set to NULL. so, in the render function, it would not be generated to html code. while for a single space, it's not null but an
reference to an realy object, so, "alt" will get rendered. For information i suggest you to look up the .net "control","htmlcontrol" nd "htmlImg" source code. :)
 
public string Alt{get {string text =base.Attributes["alt"];if (text ==null) {return string.Empty; }return text; }set {base.Attributes["alt"] = HtmlControl.MapStringAttributeToString(value); }}

string.Emptyis an instance of a string. Directly setting Attributes["alt"] to string.Empty results in an empty alt tag instead of no alt tag. It must be 'HtmlControl.MapStringAttributeToString' that's returning null when passed string.Empty.


agree. 
internalstaticstringMapStringAttributeToString(string s){if ((s !=null) && (s.Length ==0)) {returnnull; }returns;}
string.Empty is actually an object of string type.

publicstaticreadonlystringEmpty;

the code above is copied fromReflector.Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information.

set an event in a ListBox in runtime

I want to create a ListBox in runtime

dim objCoun as new listbox
objCoun.id = "lbxCountries"
objCoun.Rows = "1"
objCoun.DataTextField = "Country_Name"
objCoun.DataValueField = "Country_Id"

But when I try to set the event

objCoun.OnSelectedIndexChanged="tro"

This is the error message:

Compiler Error Message: BC30390: 'System.Web.UI.WebControls.ListControl.Protected Overridable Sub OnSelectedIndexChanged(e As System.EventArgs)' is not accessible in this context because it is 'Protected'.

Source Error:

Line 44: objCoun.DataTextField = "Country_Name"
Line 45: objCoun.DataValueField = "Country_Id"
Line 46: objCoun.OnSelectedIndexChanged = "tro"
Line 47: objCoun.DataSource=dbread
Line 48: objCoun.DataBind()

How can I set the event in runtime?

Thanks for your helpTry:


AddHandler objCoun.SelectedIndexChanged, AddressOf tro

...assuming tro is the name of your event handler with the appropriate signature:

Private Sub tro(ByVal sender As System.Object, ByVal e As System.EventArgs)

"tro" is the subroutine name. That means when the objCoun changes its index then the action is sent to "tro"

Set and Get

Hi everyone
i am working in .net since a while and i read a book for starting.
the problem is that i read on the internet a lot of examples using Set and Get method but really i didn't understand the meaning of it.
i did 2 web projects and i didn't use Get or Set.

in fact i didn't use this :
Public Property Text() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

I have never define a property, i am defining a variable or a function
for example if i need a variable i put:
dim str as string
and then i give it a value.

which situation i really need to define a property
thanks.Hi,
You should use properties to add additional processing on field access. You can, for example, perform validation before assigment or check user permissions and format data on read access.