|
It says HttpContext is not declared
|
|
|
|
|
Hi , i m working in asp.net2.0 . In menu item click i want to open a popup window . can any one help me out , m new in asp.net
saurabh bhardwaj
|
|
|
|
|
Which part are you stuck on ? Do you know any html ? Do you know any javascript ? What menu are you using ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
hi , thanx 4 reply , in asp.net i m using menu . but there is no onclick evevt so that i run a javascript fuction on that . . i dnt how to open a popup window when i click on menuitem .
saurabh bhardwaj
|
|
|
|
|
window.open is how you open a window in javascript.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi , i m using this code but nothing happend .
script language=javascript>
function openPopup("Forms/frmAssignLeave.aspx?name=" + name)
{
window.open("Forms/frmAssignLeave.aspx?name=" + name,"title", "Height=300px, Width=300px");
}
/script>
asp:MenuItem Text="Assign Leave" Value="Assign Leave" NavigateUrl='javascript:openPopup("Forms/frmAssignLeave.aspx");' ></asp:MenuItem>
saurabh bhardwaj
|
|
|
|
|
I am Using Frameset on my page
in one frame displaying treeview
which get populated from database
and when user click i want to navigate 2 frame to some another aspx
how can i do that from code ,i want to write code in cs file
on selected index changed event of treeview
|
|
|
|
|
|
Response.Redirect("someotherpage.aspx");
|
|
|
|
|
Hello All,
How to avoid page being cached. Actually i'm creating an Admin Panel so as i click on Log Out button it brings me over the Default page for Log-in again. But the back button of the browser still working and i want to stop it. For it i'm using the following code. But page is still being cached.
Response.Buffer = true;
Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";
|
|
|
|
|
there are meta tags you could use, or since you're logged in i assume there is some sort of session varible involved, which could be checked for on page load, and removed on logout, so that if the var isnt present anymore(it expired, or the user logged out) it would redirect to the login screen.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Here i'm sending my all code for checking at page load still it's not working
if (!Page.IsPostBack)
{
Response.Buffer = true;
Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";
if (Session["UserName"] != null)
{
try
{
lblMsg.Text = Session["Type"].ToString()+" ("+ Session["UserName"].ToString()+")";
}
catch
{
Server.Transfer("../Admin/Default.aspx");
}
}
else
{
Server.Transfer("../Admin/Default.aspx");
}
}
|
|
|
|
|
I use Response.Redirect instead of Server.Transfer..which seems to be a general consensus but the reason why escapes me at the moment. You dont want to put your session checking code in a !postback block. you want to check every time so that when the session expires you dont get Null reference exceptions if its used outside of a try catch. what you have should work for the first time a page loads, but wont if the user does anything while they're on that page. what happens if you get rid of the !Page.IsPostBack if statement, and run the Response lines and the if(Session["UserName"] != null on every page load?
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Sry sir i m not understanding plz explain a bit more............and i think i've already put my code here
|
|
|
|
|
you have
if (!Page.IsPostBack)
{
Response.Buffer = true;
Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";
if (Session["UserName"] != null)
{
try
{
lblMsg.Text = Session["Type"].ToString()+" ("+ Session["UserName"].ToString()+")";
}
catch
{
Server.Transfer("../Admin/Default.aspx");
}
}
else
{
Server.Transfer("../Admin/Default.aspx");
}
}
correct? what you might try is
Response.Buffer = true;
Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";
if (Session["UserName"] != null && Session["Type"] != null)
{
lblMsg.Text = Session["Type"].ToString()+" ("+ Session["UserName"].ToString()+")";
}
else
{
Response.Redirect("../Admin/Default.aspx");
}
you only need to have type in the if statement if there is a chance it could be null whitout the UserName bieng null. notice that there is no if(!Page.IsPostBack) statement, this way the code will run EVERY postback, if the session times out and the user tries something they will be redirected to the login(i assume default.aspx is your login page, if its in the same directory as the current page you dont need the relative path just Default.aspx) the nocache options are always set so the back button is effectivly broken(provided they work correctly). this should work, but if the nocache part doesnt, try using meta tags instead.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Same probs But if i put the code given below is working fine in Internet Explorer but not in Flock and Netscape
<%@ OutputCache Location="none" %>
Now please suggest wht's the problem
|
|
|
|
|
i dotn respond well to orders, when i'm trying to help someone regarless of how politely they're given. i've suggested that if changing values in the response object doesnt work to try meta tags, its what i use and they work perfectly, any decent developer would have tried the suggestion or at least mentioned trying it and having problems if it didnt work, i , for the last time, recomend you do a google search about disabling page cashing and try out what you find which should include several options that work in several browsers.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Try this in page header:
<meta http-equiv="pragma" content="nocache" />
|
|
|
|
|
where is to put this line of code u've given
Actually i'm using Master Page and Content Page so should i keep this line of code in Master Page if yes i've done it but same output getting working in Internet Explorer but not in Flock and Netscape Navigator
|
|
|
|
|
Hello,
I am trying to upload files using CopyTo function of FileInfo.
The code I am using is as follows...
FileInfo fileObj = new FileInfo(filUpload1.PostedFile.FileName);
string fileType = filUpload1.PostedFile.ContentType;
string newFileName = "test.txt";
string folderPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Uploads");
fileObj.CopyTo(folderPath + "\\" + newFileName);
The exception I am getting is...
Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\help.txt'.
Help.txt is the name of the file I selected using FileUpload control.
I could have used the SaveAs function of FileUpload control but I want to try it using above method. The files gets successfully uploaded when I do it on my machine but after uploading it on web server, it throws the above exception.
Please suggest.
Thank You.
|
|
|
|
|
Well Mr. Lucknow,
The reason behind this exception is that it is trying to find the file to be copied (in your case, it is help.txt) on the web server where it is not present.
In short, you can use this way to upload file to the web server.
|
|
|
|
|
<asp:linkbutton runat="server" id="btn_link" text="<%#Eval("p_link")%>" commandname="link" onclientclick="window.open('<%#Eval('p_link')%>');" xmlns:asp="#unknown"></asp:linkbutton>
please some one tell me why this is not work properly. can i do it or not. if not than how can i open this link in new window beacause its fill in ifrmae so open only in particular portion of the site.
thanks
I will do my best?
modified on Wednesday, August 13, 2008 8:38 AM
|
|
|
|
|
Please don't post HTML tags in your subject. It was being swallowed and thus no-one could look at your quesiton. Sorry, I didn't check to come up with a decent header.
What does 'not working properly' mean ? What is the HTML that is generated ? Is the #Eval not parsed properly ?
I am certain that as it's C# code, you can't use single quotes for the string you pass to Eval.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
thanks to reply.
yes this is c# code if i use in Eval single quote or in double quotes error is :
Error: missing ; before statement
Source File: http://localhost:1220/Adv/cate1.aspx
Line: 1, Column: 23
Source Code:
"window.open('<%#Eval("p_link")%;
how can i solve this problem
I will do my best?
|
|
|
|
|
hai,
currently i m using asp.net with c# (2.0 framework) and sql server 2000.
i finished my project and going to give the final link to my naive user (i have an intranet server with me). my link is like http://10.10.10.10:2001
Now my user need it as like his project, so that if the user enter his project name (say... MyProject) in the address bar of IE, then his project is to be open. (as like the internet link).
is there anyway to achieve it?
Thanks in advance.
KARAN
modified on Wednesday, August 13, 2008 8:07 AM
|
|
|
|