Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Helo.....

I have a problem with my code ut showing only alert box but i want to open a web page or pop up with link..how can i do this...


My code is this


C#
protected void BtnDonld_Click(object sender, EventArgs e)
   {
         string text1 = User.Identity.Name.ToString();
         if (text1 == "" || text1 == string.Empty)
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", string.Format("<script type='text/javascript'>alert('{0}')</script>", "for Download Pdf YOu have to Login"));




         }
Posted

You can execute an HTML block, with a div floating on top of the page and with the content you want to see in similar way you have done above.
 
Share this answer
 
Comments
Swinky_Talwar 11-Sep-13 0:35am    
How to change this code where i change...

Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", string.Format("<script type='text/javascript'>alert('{0}')</script>", "for Download Pdf YOu have to Login"));
Swinky_Talwar 11-Sep-13 0:37am    
i have a login page authen.aspx
CodingLover 11-Sep-13 0:45am    
Do you want to redirect the user to a different page, or do you want to authenticate user on the same pop-up page?
Swinky_Talwar 11-Sep-13 0:57am    
redirect to another page....which is my login page ...or if possible pop up with a longin link like click herer to login....which is easy i will use that
CodingLover 11-Sep-13 1:34am    
To work with a popup you can do something like this.

<script type="text/javascript">
function OpenPopup()
{
window.open("login.aspx","Demo","left = 300, top=150,scrollbars=no,resizable=no,width=400,height=280");
return false;
}
</script>

And invoke the function within the JS script in your event.
You can try to use the following JQUERY based solution...

I have embedded this popup in my own application and found it really reliable.

In case of any query, do let me know...

http://jquerymsgbox.ibrahimkalyoncu.com/[^]
 
Share this answer
 
Comments
Swinky_Talwar 11-Sep-13 1:25am    
but i want to send the link in box
VICK 11-Sep-13 1:27am    
this is editable template of JQUERY,

Have you seen the content tag like.... content: "Would you like a cup of coffee?",

here rather then sending a string in box , you can send a link , div or whatever HTML element you want.

Swinky_Talwar 11-Sep-13 1:39am    
my coding is this where can i set this
Swinky_Talwar 11-Sep-13 1:39am    
protected void BtnDonld_Click(object sender, EventArgs e)
{
string text1 = User.Identity.Name.ToString();
if (text1 == "" || text1 == string.Empty)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", string.Format("<script type='text/javascript'>alert('{0}')</script>", "for Download Pdf YOu have to Login"));
VICK 11-Sep-13 1:45am    
You can use

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "blah", "FunctionName('" + parm + "');", true);

and FunctionName will be the Jquery Function which will be added in design side..and param is parameter.. You can use it to send the content.. and in this content you can send the link as welll...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900