Solved

click Hyperlink show message box

Posted on 2006-06-13
8
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 16

Expert Comment

by:Edwin_C
ID: 16899062
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
ID: 16899474
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
ID: 16899971
hello,

please show example for Hyperlink command

i would like to send some Var to Sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:Edwin_C
ID: 16900042
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
 

Author Comment

by:sirimit
ID: 16900116
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
ID: 16900298
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
ID: 16900324
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
ID: 16900411
thank you so much Edwin C :-)
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

705 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