|
It's a repost. I tried different combinations with the problem. But I couldn't find out where I am going wrong.
I created a class which checks session and redirects to login page. My class looks like this. This class inherits Page class to get access to session object.
public class CAuthentication:System.Web.UI.page
{
public CAuthentication()
{
if ( Session["login"] == null )
Response.Redirect("expired.aspx");
}
}
My ASPX.CS looks like
public partial class MyPage:CAuthentication
{
}
This is not working. I am getting error "session can't be used inside a class" . What is wrong here ? Normally codebehind file used to inherit System.Web.UI.Page , Instead of this I inherited this in my CAuthentication class. Where I am going wrong ?
|
|
|
|
|
you dont have to inherit CAuthentication class instead let it be System.Web.UI.Page . You have to assign the session value as null in the session_start ,in the Global .asax.cs file . And also u have to assign the values in the page_load where it can be processed when the session is not null.
VanithaVasu
|
|
|
|
|
VanithaVasu wrote: You have to assign the session value as null in the session_start ,in the Global .asax.cs file
What do you mean ?
I think you are telling to check session null in each page load. right ? To avoid that I have written this one.
|
|
|
|
|
Hi
In my application I got two columns,one is for Serial No. other one is for CheckBox.
I have get value from DataBase and fill into this DataGrid,for Serial No. I have Interger column in DataGrid and for CheckBox Tinyint.For CheckBox column in DataGrid values r 0 and 1.
My problem is that I have to get both the values simultaneously, if the value in CheckBox column is 1 then the CheckBox in the DataGrid should check,if it is 0 it should uncheck.
How can I get Serial No. in one column and checking of CheckBoxes in another.
What shuold I use for Getting values from DataBase; DataReader or DataSet
Plz suggest me an example.
I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison
Thank u
Chandu
|
|
|
|
|
After binding grid, you can iterate through the grid rows by checking your condition. If your condition satisfies, get the checkbox id and check it.
Or you can use ItemDatabound event for datagrid. Datagrid will fire this event when each row created. In this event you can take serial number from datagrid, do a select to your table and check the checkbox depends on value.
chand10 wrote: What shuold I use for Getting values from DataBase; DataReader or DataSet
I prefer DataSet
|
|
|
|
|
Hi Friends,
For my client I have to develop a smart client application. But what is a Smart Client Application and which template should I use for that. Please suggest me.
Thanks in advance.
Thanks,
Arindam D Tewary
|
|
|
|
|
I gotta tell you, if you don't even know what a smart client application is, and if you can't use google to find out, then no template is going to enable you to meet your clients expectations. Your best move is to tell the client you don't know how to do it now, not when they are expecting you to deliver something.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I would like know why ASP.Net has introduced the new directories and what is their significance. Are they meant for just logical seperation and to help in easily organising stuff or any other strong reason. And if we consider app_code folder which is meant for code files like .cs, .vb etc. What if I place any codefile outside of this folder.Because when I placed a .cs file in app_code folder and tried to compile it it was not compiling.
Can someone let me know what these folders are really for...
Thanks:
Rakesh
|
|
|
|
|
rockyl wrote: Are they meant for just logical seperation
It's ASP.NET 2.0 or later architecture.
rockyl wrote: And if we consider app_code folder which is meant for code files like .cs, .vb etc. What if I place any codefile outside of this folder
If you want to share some classes in whole application, you can keep them inside app_code. Classes inside app_code will be compiled automatically at runtime. ASP.NET treats whole app_code as single assembly.
rockyl wrote: I placed a .cs file in app_code folder and tried to compile it it was not compiling.
What was the error you are getting ?
|
|
|
|
|
Hi,
I am trying to print a document and then save it!
I first opened the document using Open(ApplicationClass, Word..) then
I activated the printer which is required then
I used printoutold
After printing a dialog box appears asking the user to enter a name to save the printed file.
Is there a way that i could avoid this user interaction and give the name of the file directly so that after printing it directly saves at the given location.
gauthee
|
|
|
|
|
|
Hi all, I get the following error when trying to build my website but can't figure out why.
error CS1002: ; expected
<%for(int a = 0; a < AdItems.Tables[0].Rows.Count; a++)
{
%>
<tr>
<td>
<div class="casinopromotions"><img src="<%=ResolveUrl(AdItems.Tables[0].Rows[a]["image_url"].ToString()) %>" alt="<%=AdItems.Tables[0].Rows[a]["image_alt_text"].ToString() %>" width="<%AdItems.Tables[0].Rows[a]["image_width"].ToString() %>" height="<%AdItems.Tables[0].Rows[a]["image_height"].ToString() %>" />
</div>
</td>
</tr>
<%
}
%>
Any suggestions and pointers to possible causes will be greatly appreciated
Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Don't worry, I found my problem. I did not include the = after the <% for width and height
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
I would rather suggest a CodeBehind check instead of using IF ELSE in .ASPX page increasing the clutter.
|
|
|
|
|
Its just one for loop, not if else, but will check if I can do it in codebehind, thanks for the suggestion
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
I developed an ASP.NET Application and I want to ensure that who ever uses my application, is installed with .NET Framework 2.0 on their system. If not, the application should first install the .NET Framework 2.0 and then runs the application.
Let us assume the .NET Framework 2.0 is not installed on one system. So now, how I can make my application to run the .NET Framework 2.0 to run (install) on a click of the link.
|
|
|
|
|
You can provide a link to the framework, sure. You realise they don't need it installed to view your site, right ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: You realise they don't need it installed to view your site
25 MB download + 5 minute installation + 500 MB diskspace to view a website. I would just close the 'X' icon at the top right of the window, if that is the case.
|
|
|
|
|
Aslong as the framework is installed on the server hosting the website, the users wouldn't need the framework installed, is there a specific reason that you want to install the framework on the users?
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Hi All!
In ASP.NET application, we have to give refferences of namespace in pagename.aspx.cs as:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FE_SymmetricNamespace;
using System.IO;
is there is any way to give refferences in web.config file instead of using each page?
|
|
|
|
|
I Never Look Behind wrote: web.config file
You can access web.config key elements using System.Configuration
|
|
|
|
|
Hello frnd,
i have a datagrid/GridView having one combobox and one radio button on it and at the end of the end there is a button named "Add" when i clicked that button sasme row should be add to data grid/Grid View
please help...
thankx in advance
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
would you please discribe the problem more and be more specific
|
|
|
|
|
Try this link
http://www.dotnetjohn.com/articles.aspx?articleid=27
|
|
|
|
|
Hi,
I have created such a web application that, user can upload photos by simply drag and drop method, means user have to drop the photo on the one cotrol on the web page. then he will get path of that photo in listbox. So I have to take that path and upload that file to server. It is working fine for local PC by File.Copy method. But it dose not working on server.It gives error as "Illegal characters in path."
can any one help me??????
Thanks!
I solve the above error but now one error is throwing i.e. Could not find a part of path
-- modified at 5:58 Tuesday 7th August, 2007
|
|
|
|