LinkButton Target

  • Thread starter Thread starter ruca
  • Start date Start date
R

ruca

Can I define a frame target in a LinkButton control like we can use in
hyperlinks???

I have a page where I have two frames (left and right frames) in my left
frame I have a menu contents (where I would like to use LinkButtons). When I
click in one of the buttons I want to open in my right frame (target).

Can I do that?
 
A LinkButton is designed to look like a hyperlink, but operate like a
button. Hence, the handler for the click event (which occurs on the server)
will be in the class that holds this button, which is the current page
class.
 
I don't recommend it but you could look into using RegisterStartupScript in
your click method. I think instead you should just put a hyperlink in place
of the linkbutton.

-Stanley
 
Hello.

I also looked at using a LinkButton to open an aspx page in another
frame. I know aps:Hyperlink controls are to be used for that.

But then, passing parameters is an issue. I explain:

I have a page with a asp:Hyperlink control and an asp:TextBox
control.
When the Hyperlink control is pressed, I want to open another aspx
page in another frame and supply the value entered in the TextBox.
This is a problem.

I already thought of using the AutoPostBack property of the TextBox.
Then when the TextBox loses focus, I react to that event in the
code-behind file and change the NavigateUrl of the hyperlink like
this:

MyHyperlink.navigateUrl = "newpage.aspx?Param=" + TextBox.Text;

However, pressing the Hyperlink means that the TextBox loses focus and
this code is executed. But the 'real' hyperlink action is not
executed (the new page is not loaded). To achieve that, the hyperlink
must be clicked twice now.

Any suggestions?
 
Back
Top