Solved

click Hyperlink show message box

Posted on 2006-06-13
8
381 Views
Last Modified: 2006-11-18
Hello,

i would like to use Hyperlink when onclick go to Sub and show Message Box : Success (when execute all command in Sub)

please suggest me

thank you so much
0
Comment
Question by:sirimit
  • 5
  • 3
8 Comments
 
LVL 16

Expert Comment

by:Edwin_C
Comment Utility
If you need to execute a subroutine (assume server side), then you need a button control rather than a hyperlink.

You can use a linkbutton (which renders as hyperlink) and in its click event

mySubroutine()  'execute your subroutine
Response.Write("alert('Things are done!')")   'show your message box

Hope that helps
Edwin
0
 
LVL 16

Expert Comment

by:Edwin_C
Comment Utility
Oops, it should be

Response.Write("<script>alert('Things are done!')</script>")   'show your message box

Sorry about forgetting the script tag!

0
 

Author Comment

by:sirimit
Comment Utility
hello,

please show example for Hyperlink command

i would like to send some Var to Sub
0
 
LVL 16

Expert Comment

by:Edwin_C
Comment Utility
Is your "hyperlink" inside a datagrid or similar databound controls?  You say you want passing some parameters into the subroutine.  Where do the values of the parameters come from?  Some textboxes, a constant or else?
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:sirimit
Comment Utility
Hello,

i used datagrid Parameter is : Container.DataItem("field") about 2-3 values
i would like send it toSubroutine and show in all row

Example (i need create link when click send Parameter(col1,col2) to Subroutine)
_________________________
col1 | col2 | col3 | col4 | link
_________________________
col1 | col2 | col3 | col4 | link
_________________________
col1 | col2 | col3 | col4 | link
_________________________
col1 | col2 | col3 | col4 | link
_________________________
0
 
LVL 16

Expert Comment

by:Edwin_C
Comment Utility
Firstly add a ButtonColumn in your datagrid like this.

<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
<Columns>
  <asp:BoundColumn DataField="col1"></asp:BoundColumn>
  <asp:BoundColumn DataField="col2"></asp:BoundColumn>
  <asp:BoundColumn DataField="col3"></asp:BoundColumn>
  <asp:BoundColumn DataField="col4"></asp:BoundColumn>
   <asp:ButtonColumn Text="Link" CommandName="doSub"></asp:ButtonColumn>
</Columns>
</asp:datagrid>

Then add a handler for the ItemCommand event

Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
        If e.CommandName = "doSub" Then
            doSubroutine(e.Item.Cells(0).Text, e.Item.Cells(1).Text)
        End If
End Sub
0
 
LVL 16

Accepted Solution

by:
Edwin_C earned 500 total points
Comment Utility
Oh I forgot you need a message popup.

Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
        If e.CommandName = "doSub" Then
            doSubroutine(e.Item.Cells(0).Text, e.Item.Cells(1).Text)
            Response.Write("<script>alert('Success')</script>")
        End If
End Sub
0
 

Author Comment

by:sirimit
Comment Utility
thank you so much Edwin C :-)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now