简体   繁体   中英

VB.NET MessageBox using Code Behind variables @ OnClick

I have the following procedure which when the Select Button is clicked returns a number of values from the row in the GridView which the Select Button was clicked in. These values are stored as variables. This procedure executes as part of code behind (VB). I would like to pass the variable BodyOfEmail to the non-code behind (aspx) page and create a pop up window which lists the values. I guess the main issue I am having a hard time with is how to link to pop up message to this onclick procedure.

Public BodyOfEmail As String

Protected Sub GridView2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView2.SelectedIndexChanged, GridView1.SelectedIndexChanged
  Dim Number, BodyOfEmail, FullName As String
  Dim RowValue As Double

  RowValue = GridView1.SelectedDataKey.Value - 1
  Number = GridView1.Rows(RowValue).Cells(5).Text.ToString
  FullName = GridView1.Rows(RowValue).Cells(25).Text.ToString
  BodyOfEmail = Number & " " & FullName
End Sub

Thanks

you cannot mix and match client and server code. it's either javascript or VB. you can use registerscript methods to dynamically generate javascript when the page is rendered and you can send/get data from the server on the client using ajax.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM