473,804 Members | 4,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically create and call a function

MRW
Hello!

I'm trying to do something very simple. On the bottom of my page, I
want to dynamically create and display something like (in hyperlink
text):

Home | Page 1

and if x = 1 (for example), I want it do display:

Home | Page 1 | Page 2

So, when they click "Page 2", it will run a VB function on the server.

Using javascript, I could easily use Response.write <a href..., however
I want to call the function on the server.

Thanks for any help!

Aug 6 '06 #1
7 1251
An easy way to do this would be to simply put ?func=1 on the querystring, and
intercept that in your Page_Load, e.g., (C# here)

if(Request.Quer ystring["func"]=="1")
MyMethod( Request.QuerySt ring["func"]);

You should also check for querstring being null above this.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MRW" wrote:
Hello!

I'm trying to do something very simple. On the bottom of my page, I
want to dynamically create and display something like (in hyperlink
text):

Home | Page 1

and if x = 1 (for example), I want it do display:

Home | Page 1 | Page 2

So, when they click "Page 2", it will run a VB function on the server.

Using javascript, I could easily use Response.write <a href..., however
I want to call the function on the server.

Thanks for any help!

Aug 6 '06 #2
MRW
Something so simple, yet works so well! Thanks very much for the help!

Peter wrote:
An easy way to do this would be to simply put ?func=1 on the querystring, and
intercept that in your Page_Load, e.g., (C# here)

if(Request.Quer ystring["func"]=="1")
MyMethod( Request.QuerySt ring["func"]);

You should also check for querstring being null above this.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MRW" wrote:
Hello!

I'm trying to do something very simple. On the bottom of my page, I
want to dynamically create and display something like (in hyperlink
text):

Home | Page 1

and if x = 1 (for example), I want it do display:

Home | Page 1 | Page 2

So, when they click "Page 2", it will run a VB function on the server.

Using javascript, I could easily use Response.write <a href..., however
I want to call the function on the server.

Thanks for any help!
Aug 6 '06 #3
"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com wrote in message
news:FB******** *************** ***********@mic rosoft.com...
You should also check for querstring being null above this.
And also for users changing the QueryString manually...
Aug 6 '06 #4
MRW
Mmmm... is there a way to bypass that problem? Not that it's the
biggest problem in the world...

Mark Rae wrote:
"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com wrote in message
news:FB******** *************** ***********@mic rosoft.com...
You should also check for querstring being null above this.

And also for users changing the QueryString manually...
Aug 6 '06 #5
"MRW" <mw*****@yahoo. comwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
Mmmm... is there a way to bypass that problem?
Not while using QueryStrings...

I never ever use QueryStrings unless there's absolutely no other option for
this precise reason and, if I have to use them, I encrypt them...

Aug 6 '06 #6
Personally, I think this is an issue that is heavily "overblown" by the
so-called security pundits. Sure, if somebody manipulatiing your querystring
is going to
cause financial or other security breaches, of course it's an issue. But in
many
cases it is used for nothing more than simple navigation or in your case for
deciding whether to call a method that displays some control or not.

You can still use the querystring and obfuscate it quite nicely. Here is an
article
I did on a technique for this. You can see how I got flamed for it by people
with nasty agendas who either cannot read, or never even got past the third
paragraph:

http://www.eggheadcafe.com/articles/20060427.asp

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MRW" wrote:
Mmmm... is there a way to bypass that problem? Not that it's the
biggest problem in the world...

Mark Rae wrote:
"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com wrote in message
news:FB******** *************** ***********@mic rosoft.com...
You should also check for querstring being null above this.
And also for users changing the QueryString manually...

Aug 6 '06 #7
"Peter Bromberg [C# MVP]" <pb*******@yaho o.nospammin.com wrote in message
news:E6******** *************** ***********@mic rosoft.com...
You can still use the querystring and obfuscate it quite nicely. Here is
an
article I did on a technique for this. You can see how I got flamed for it
by people
with nasty agendas who either cannot read, or never even got past the
third
paragraph:

http://www.eggheadcafe.com/articles/20060427.asp
Actually, it's a pretty good article. If you absolutely *have* to use
QueryStrings, encryption / obfuscation like this is really the only sensible
way to do it...
Aug 6 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4835
by: Falc2199 | last post by:
Hi, Does anyone know how to make this work? var sectionId = 5; repeat_section_sectionId(); function repeat_section_5(){ alert("firing"); }
11
2299
by: Steven D'Aprano | last post by:
Suppose I create a class with some methods: py> class C: .... def spam(self, x): .... print "spam " * x .... def ham(self, x): .... print "ham * %s" % x .... py> C().spam(3) spam spam spam
7
2533
by: Ron Goral | last post by:
Hello I am new to creating objects in javascript, so please no flames about my coding style. =) I am trying to create an object that will represent a "div" element as a menu. I have written several methods that are working fine. The problem is if I want to dynamically assign an event handler to the object, the event handler is not called. What am I doing wrong? Below is a sample HTML doc with everything in place. <!DOCTYPE HTML PUBLIC...
1
2287
by: johnjsforum | last post by:
Buddies, I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function //////////////////////////////////////////////////////////////////////////////////// version 1 : using global variables ////////////////////////////////////////////////////////////////// var _textField, _divColorPicker; // global vars window.onload = function() { _textField = document.getElementById('htxaMessage'); // fill...
3
5279
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first add the pane the remove event does not get handled, though thereafter it is handled without problems. ==================================================
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9589
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10593
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.