Web Forms :: How To Place The Name Of A Vb Subroutine In A Session
Feb 25, 2011
If I have a subroutine in codebehind called:
Subroutine1
and I store it in a session:
Session("tempSub") = "Subroutine1"
How can I then pull it out of the Session and call it?
something like this, but it doesn't work.
Dim tempSub as object = Session("tempSub")
tempSub()
Which would actually be subroutine1() if it actually worked.
View 3 Replies
Similar Messages:
Feb 25, 2011
I have a subroutine in a content page that I want to be able to call from codebehind of a subroutine in a master page.
View 4 Replies
May 3, 2010
which place(exact folder) the session & session id will be stored?
View 8 Replies
Aug 21, 2010
I am getting a serialization error trying to use Session State Server instead of InProd. However, I can't figure out what is causing the error in session. I was given some code to add to the page to loop through the session object and figure out if each item in it is serializable. My problem is I don't know where to place the code in the ASP.NET page. In tracing through the code, the error just appears after steping through objects outside of the page and not when setting session. There must be some place that I can place the code on the page that is after all session objects are set but before the page will error. Where would that be?
View 2 Replies
Feb 15, 2011
(I have a feeling i'm making a mental error thinking this is possible, because it seems too easy, but here goes)
For my intranet web app with 20 users on slow machines, the view state is slowing down their browsers.
But the network is local and fast. So I think to myself, why bother putting all that data on the user's browser?...Something like putting it in the database and then all the page needs to maintain is a unique key. But then I remembered that's how session state pretty much works.
QUESTION: Am I missing something or is this really possible?
View 2 Replies
Feb 1, 2010
I an using Session for storing UserName for whole project. But it always time out before 20 min. I want set value in properties and want to use in project but when my page is loading again its showing null value.
How can i save this value in this?
Code what i am using.
public string UserName {get; set; }
public string Password {get; set;}
View 2 Replies
Mar 5, 2011
I am trying to create one subroutine that can handle all deletes for a web app. I have one delete popup panel in my master page, and I call it each time from my content pages. When an instance of delete is called from a content page, I store the name of a delete subroutine specific to the delete instance in a session variable and popup the delete panel in the master page. If a user types YES into a delete textbox in delete popup panel, a confirmDelete Subroutine in codebehind of the Masterpage is called. When the confirmDelete subroutine in the Masterpage is callled, I want to call a subroutine in the content page that has the name stored in the session variable. What is the simplest way to do that?
View 1 Replies
May 28, 2010
I'm trying to pass in an ID of an activity (RefNum) to my codebehind via OnDataBound called in the CheckBoxList, but can't seem to find the correct syntax.
I know I'm supposed to use parentheses when passing parameters to subroutines and methods, and I've tried a number of ways and keep receiving the following error:
BC30203: Identifier expected.
So I tried to hard-code it in the code below [ OnDataBound="FillSectorCBList("""WK.002""")" ], but it's obviously wrong. :(
Front-end:
[Code]....
Code-Behind:
[Code]....
View 6 Replies
Jan 20, 2010
I have a GridView control which is populated by an SQLDataSource. When I select a row the details are shown in a DetailsView control. Is it possible to intercept the select and run a VB subroutine at the same time so that I can make a Panel in a separate part of the page disappear?
View 2 Replies
Jan 12, 2011
I am not trying to activate an event or run a subroutine from a control from the masterpage, I am trying to activate or run from VB codebehind of the master page.
I have a button in a content page with a particular .click even that I want to activate from the masterpage codegehind periodically.
Also, how do I access or run a subroutine in a content page from codebehind in a master page.
View 7 Replies
Jul 6, 2010
I have an ASP.NET application that needs to remember some info about a user (and what company they are from) across pages, within a session. I imagine this is a requirement of just about any ASP.NET application of a certain size. I've used a few different approaches over the years. In the past, I've passed around an id in querystring parameters like so: [URL] and then instantiated the object on each page (from the database). Another common way of doing it is storing my objects in session variables:
Session["User"] = currentUser; // store at login
User currentUser = (User)Session["User"]; // retrieve on some other page
which saves a trip to the DB, but I worry about memory used if the User object is complex and the site has many concurrent users. I have recently inherited an application that uses public properties on the master page, like this:
Master.theUser = currentUser; // store at login
User currentUser = Master.theUser; // retrieve on some other page
This saves the cast, and looks more readable to me I think, but I don't know if it's better or worse performance-wise. It also has some logic in the getter where if the private value is null, it tries to get it from the Session variable, though I'm not sure if that's never used (or used every get!?) or what. My latest idea is to use my page class. I have a custom page class derived from the standard System.Web.UI.Page base class. It includes objects like CurrentUser as public properties. This seems to work OK. I like it even better. But I really don't know what's going on under the covers. Can anyone give an opinion on which approach is better and why?
Update: I've done some checking use trace.axd and Trace.Write and it looks like neither the masterpage version nor the custom page class version "remember" the values between pages. The "get" methods have a line of code that checks if the User property is null, and if so, reads it from the session variable. This happens when a page accesses the property (Master.User or the derived class's this.User) for the first time on a given page, then subsequent requests can get the value (without going to the session variable). So thus far the best solution looks something like this:
public class MyPage : System.Web.UI.Page
{
private User user;
public User User
{
get
{
if (user == null)
{
user = (User)HttpContext.Current.Session["CurrentUser"]; //check if session[CurrentUser] is null here and log them out if so?
}
return user;
}
set
{
user = value;
HttpContext.Current.Session["CurrentUser"] = value;
}
}
}
Then on any webpage.aspx.cs, you can do something like this: UsernameTextBox.Text = User.FullName;
View 2 Replies
Apr 2, 2010
is there any reason for me to place the session ID within a form, as a hidden form field?
View 3 Replies
Feb 25, 2010
I have a code which I repeat over and over so I am thinking to write subroutine. Not sure if there are functions in C#. Could you advise how to pass arguments to it. An example of add two numbers would be great.
View 1 Replies
May 12, 2010
I was wondering if it would be possible to do something like this.
[Code]....
View 4 Replies
Jan 12, 2010
In a base class object, I have an overridable subroutine that I would like all derived objects to have the ability to include. However, they don't have to, and if it's not necessary for them to use it, I don't want them to be forced to declare it. To enforce this, I've left the default behavior empty. For example, here's my whole sub:
Protected Overridable Sub MySubroutine(ByVal someObject As Object)
End Sub
Is this bad practice? I don't want to declare it as MustOverride, but I don't want default behavior. Is there a "better" way of doing this, or is this perfectly acceptable? I don't want to be that hack programmer... just trying to learn :)
View 2 Replies
Apr 1, 2011
I want to place two datalist controls at the same (x,y) position. When the first is visible, second should be invisible.
How would I go about implementing this?
View 2 Replies
Oct 21, 2010
I have a user control with data of person. iN this user control is subroutine which storing data to database of person.On my ASPX page I've implemented this control and another form with data which ii'm storing.On button click on ASPX page, i want to store all my data including data from my user control or subroutine in that user control which storing data of person.I want to make sqltransaction, so only one connection for aspx page and user control.ASPX.vb
[code]...
The point of my question is how to interact between my class where i have methods and user conttorl on aspx page.
View 5 Replies
Aug 4, 2010
I seem to be having trouble getting the btOK button (in the Modal Popup Extender panel) to trigger the btOK_Click subroutine in the code-behind for the page.
ASP
[Code]....
VB.NET
[Code]....
I have the OnOKScript set to the name of the subroutine, and have tried setting the value to "btOK_Click", "btOK_Click;" and "btOK_Click(this);" but none have worked. In a previous page I have used this to call a JavaScript function, but surely I can call the VB.NET code from here too?
View 2 Replies
Oct 17, 2010
I am building in error-logging into my site, and want to be able to get hold of the current page name that the error occurred in, as well as the specific subroutine or function, to then pass to a VB.NET function. Is there anyway to get hold of this information without hard-coding the names manually? For example,
Dim strCurrentPageName = ???
Dim strCurrentRoutine = ???
View 6 Replies
Feb 23, 2011
As part of a subroutine for downloading files to the customer, I have
<code>
Response.ContentType = "application/msword"
</code>
What should I write if I want to download a Power Point presentation?
View 3 Replies
Mar 4, 2010
I'm trying to figure out how to use skins, and I'm a bit baffled by one thing. When I place a skin file in the "root" of the theme I'm working on, it works great. However, if I try to make a folder to put it in, it fails. I cannot seem to locate any particular information that describes why this is. This is what works:
/App_Themes/App_Themes/MyTheme/App_Themes/MyTheme/MySkin.skin
This is what I'd prefer, but does not work
/App_Themes/App_Themes/MyTheme/App_Themes/MyTheme/skins/App_Themes/MyTheme/skins/MySkin.skin
View 2 Replies
May 7, 2015
how to use this :
<globalization culture="en-GB" />
tag in web.config ? i mean under which tag do it have to be placed ? and then how will i apply this culture to all pages ?
View 1 Replies
Apr 30, 2010
to place the data contained in .xls, .doc (or) .docx file to asp.net(c#) web page.Else we can attach to database ?
View 1 Replies
Jan 27, 2010
I have two the below regular expressions for a textbox , to validate.
^(([01]?dd?|2[0-4]d|25[0-5]).){3}([01]?dd?|25[0-5]|2[0-4]d)$ - Validation Expression For IP Address
^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])$ - Validation Expression for Host name
I want to use both these for the same textbox, It should fullfill either of these conditions. What should I do so as to satisfy my condition.
View 3 Replies
Jul 8, 2010
way to write a comment at particular place in HTML from C#? For example, after a particular label? I can write a comment as follows:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("<!-- " + ... " -->");
}
but this appears before the DOCTYPE. I'd like to write it at a particular place, or at least in the "body".Thinking about it, I guess I could create a comment label at the beginning of the body and write it there:
Label1.Text = "<!-- " + ... " -->";
Is there a way to make sure it is in the body if I do not have a Label already defined for the purpose.
View 1 Replies