Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

System.Web.UI.WebControls.CommandEventHandler(LinkButton_Command)

Posted on 2006-07-19
5
Medium Priority
?
667 Views
Last Modified: 2008-01-09
ASP.NET , C#
I have the following event handler set in a LinkButton control, which I placed into Page_Load.
I want to use the CommandEventHandler(LinkButton_Command) value after PostBack back in
Page_Load to filter a query, which eventually updates the same lbtn property. Needless to say,
I can't seem to be able to get the  CommandEventHandler(LinkButton_Command) value back into Page_Load.
                   
lbtn.CommandArgument = i.ToString();
                   
lbtn.Command += new System.Web.UI.WebControls.CommandEventHandler(LinkButton_Command);
0
Comment
Question by:JoeUS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17141569
>>I can't seem to be able to get the  CommandEventHandler(LinkButton_Command) value back into Page_Load.
That doesn't make any sense.  The value of what?

Bob
0
 

Author Comment

by:JoeUS
ID: 17141776

CommandEventHandler(LinkButton_Command)
calls the following method      
protected void LinkButton_Command(Object sender, CommandEventArgs e)
and in this method
e.CommandArgument holds the value of  lbtn.CommandArgument = i.ToString()

now here I make a
public string lbtnValue = e.CommandArgument;
but get nothing in lbtnValue in Load_page

I hope it helps
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1500 total points
ID: 17141966
This is the order of things:

1) Click on a LinkButton control
2) An post-back occurs
3) The Page_Load event is fire
4) The LinkButton_Command event is handled

As you can see, you can't get the value from Page_Load, because it hasn't happened yet.

Bob
0
 

Author Comment

by:JoeUS
ID: 17149381
so,
what is your suggestion to solve this problem.
I tried to set the value into a session var, label, text in the method they don't show up in Page_Load only after the second post-back.
Generally, how do get the LinkButton_Command event value back in one trip if I dynamically create a control and place it into Page_Load?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17160370
Can you describe the bigger picture and what you need to accomplish, so that I could recommend the "best" course of action, please?

Bob
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question