[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • Last Modified:

click Hyperlink show message box

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
sirimit
Asked:
sirimit
  • 5
  • 3
1 Solution
 
Edwin_CCommented:
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
 
Edwin_CCommented:
Oops, it should be

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

Sorry about forgetting the script tag!

0
 
sirimitAuthor Commented:
hello,

please show example for Hyperlink command

i would like to send some Var to Sub
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Edwin_CCommented:
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
 
sirimitAuthor Commented:
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
 
Edwin_CCommented:
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
 
Edwin_CCommented:
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
 
sirimitAuthor Commented:
thank you so much Edwin C :-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now