Hi Gary,
Thank you for posting in the community!
Based on my understanding, when you click a link, you want to postback to
server side(Do validation and pass parameters), which need LinkButton. But
you did not figure out a way to open the navigation page in a new browser
window.
==============================================
For your passing parameters for POST, which page you want to POST to? POST
to your server side or POST to the navigation page?
I suppose you want to POST the web form data to your server side. (If I
misunderstand you, please feel free to tell me)
Asp.Net only encapsulate the client HTML and javascript code, so you still
need client side support to open a new browser window.
You can try the following 2 Solutions to see if it helps resolve your issue:
1). Open your navigate window in <a>'s onclick client javascript
First, add client javascript function:
<script language=javascript>
function navigation()
{
window.open("
http://www.google.com");
}
</script>
Then, Register <a>'s client onclick event handler:
private void Page_Load(object sender, System.EventArgs e)
{
LinkButton1.Attributes.Add("onclick","navigation()");
}
2). Register client javascript code to open a new window in LinkButton's
Server side click event:
First, make <body> as server side control:
<body runat=server id="bodycontrol">
Then, register javascript in LinkButton's server click event:
private void LinkButton1_Click(object sender, System.EventArgs e)
{
StringBuilder sb=new StringBuilder();
sb.Append("<script language=javascript>");
sb.Append("function navigation()");
sb.Append("{\n");
sb.Append("window.open(\"
http://www.google.com\");");
sb.Append("\n}");
sb.Append("</script>");
this.Page.RegisterClientScriptBlock("navigationscript",sb.ToString());
bodycontrol.Attributes.Add("onload","navigation()");
}
================================================
Please apply my suggestion above and let me know if it helps resolve your
problem.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Have a nice day!!
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.