Click here to Skip to main content
15,895,829 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I wanna when click on the button display the popUp and in the popup a gridview with to columns
this is what i have tried in page finance
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButSchedule.Click
       Dim ds As New DataSet
      Dim dt As New DataTable
      Dim x As Double
      Dim y As Double
      Dim z As Double
      If txtFrom.Text = "" Then
          x = 0
      Else
          x = txtFrom.Text
      End If
      If txtTo.Text = "" Then
          y = 0
      Else
          y = txtTo.Text
      End If
      If TextBox3.Text = "" Then
          z = 0
      Else
          z = TextBox3.Text
      End If
      Session("LoadData") = ds.Tables("tabel1")
      Session("fromMonth") = x
      Session("toMonth") = y
      ' Dim SUMSALARY As Integer
      Session("SUMSALARY") = (z / (y - x + 1))
      ButSchedule.Attributes.Add("onclick", "window.open('salaryAA.aspx','','location=0,resizable=1,ScrollBars=1,statusbar=1,width=400,height=300,left=20,top=10,moveable=0') ;return false")

  End Sub


What I have tried:

this in page salary>>
Sub sorting()
         Dim dt As New DataTable
        dt.Columns.Add(New DataColumn("Month", GetType(Integer)))
        dt.Columns.Add(New DataColumn("Salary", GetType(Double)))

        For i = Session("fromMonth") To Session("toMonth")
            Dim drr As DataRow = dt.NewRow()
            drr("Month") = i
            drr("Salary") = Session("SUMSALARY")
            dt.Rows.Add(drr)
        Next
        Session("LoadData") = dt
        dt.AcceptChanges()
        GridView1.DataSource = dt
   
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            sorting()
        End If
    End Sub
<pre>
Posted
Updated 5-Jun-16 0:44am
v2
Comments
CHill60 1-Jun-16 9:49am    
Try debugging the button click and check the values in z, y, and x and Session("SUMSALARY") to see if that If condition is satisfied - by the way you should not just assign text values to those variables as they are doubles.
Sergey Alexandrovich Kryukov 1-Jun-16 9:58am    
First of all, you need to tag your application type and UI framework/library you are using.
See also: SSCCE.
—SA
Karthik_Mahalingam 1-Jun-16 9:59am    
remove the IF condition and try running it.
may be the session value and the (z / (y - x + 1) calc is not matching.
ZurdoDev 1-Jun-16 10:01am    
Debug it. Make sure the code to add the window.open is actually running. Then examine it in the html source to make sure all strings are enclosed properly. Simple debugging will have you fixed in no time.

1 solution

You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.

The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]

Note that your popup is inside a IF structure, if the condition is not satisfyed, it will not display.
Use the debugger to check the variables values and check if condition is satisfied.
 
Share this answer
 

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