Saturday, March 31, 2012

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.