Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 19th, 2010, 10:10 AM
Registered User
 
Join Date: Feb 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Call a function from codebehind in HTML

hI,
How can i call a function from codebehined from aspx to designer page when onclick event. something like this. i do not wana use javascript is there a way to do this. following do not work.
<li><a href="#" onclick='<%Redirect()%>'>Blog</a> </li>
  #2 (permalink)  
Old April 19th, 2010, 02:11 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What are you trying to achieve?
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
  #3 (permalink)  
Old April 19th, 2010, 04:05 PM
Registered User
 
Join Date: Feb 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Call a function from codebehind in HTML

i am trying to call a method html code <a onclick="somemethod()></a> from the code behined .In the method i m trying to check if the session is available if not i will take to login page other wise to something else page
make sense ??
  #4 (permalink)  
Old April 19th, 2010, 04:06 PM
Registered User
 
Join Date: Feb 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Call a function from codebehind in HTML

i am trying to call a method in html code something like this
<a onclick='<somemethod()"></a> from the code behined .In the method i m trying to check if the session is available if not i will take to login page other wise to something else page
make sense ??
  #5 (permalink)  
Old April 19th, 2010, 05:10 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Ahhh. I would just use a button and handle the Session check in the click event handler. Here is how I would do it with a link button:

asp Code:
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">LinkButton</asp:LinkButton>

Then the click event handler:

csharp Code:
protected void LinkButton1_Click(object sender, EventArgs e)
    {
         //Check for session
    }

Now it is pretty obvious that you are a beginner to .NET so might I suggest Imar's new book: http://www.amazon.com/Beginning-ASP-...dp/0470502215/ Imar is an amazing author and his work is spot on.

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
  #6 (permalink)  
Old April 19th, 2010, 05:40 PM
Registered User
 
Join Date: Feb 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Call a function from codebehind in HTML

i was aware about the button link but i do not wana use the server control. my requirement was to do something with <a> </a>. any help with this one.
  #7 (permalink)  
Old April 19th, 2010, 05:44 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

If your requirment is to use a plain HTML anchor tag and NO javascript you are simply out of luck unless you go back to a classic ASP type model where you post from one page to another but that seems a bit overkill IMHO.

-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
  #8 (permalink)  
Old April 19th, 2010, 05:45 PM
Registered User
 
Join Date: Feb 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Call a function from codebehind in HTML

I am aware about IMAR . he is a good author i have been following his blog.
so do u think if i buy ASP.NET 4 will it cover all basic stuff from 2.0 n 3.5
  #9 (permalink)  
Old April 19th, 2010, 06:00 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

The .NET 4.0 books are going to focus mostly on what is new in 4.0; while some of this material would be backwards compatiable with 2.0 and 3.x things like the TPL and changes to the language would not (obviously). Below are the 2.0 and 3.5 versions of this book.

http://www.amazon.com/Beginning-ASP-.../dp/0470042583
http://www.amazon.com/Beginning-ASP-.../dp/047018759X

hth
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Call a Function stealthdevil Access VBA 2 November 2nd, 2006 10:38 AM
calling a codebehind function on onblur event vishnupriya.kamalakaram ASP.NET 1.0 and 1.1 Basics 2 July 7th, 2006 09:25 AM
How to call javascript function from VB function vinod_yadav1919 VB How-To 0 February 13th, 2006 06:03 AM
Calling codebehind C# function from aspx page ravindrasingh77 BOOK: ASP.NET Website Programming Problem-Design-Solution 2 March 16th, 2005 12:08 AM
Call codebehind function from ASPX collie VB.NET 2002/2003 Basics 1 September 2nd, 2004 04:31 AM



All times are GMT -4. The time now is 09:29 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.