弹出窗口中的gridview显示。但它没有填充数据(月,薪水)....? ! ! !我正在编辑代码 [英] The gridview in the popup displaying.but it's not filling by data (month, salary) .... ? ! ! ! I'm editing the code

查看:44
本文介绍了弹出窗口中的gridview显示。但它没有填充数据(月,薪水)....? ! ! !我正在编辑代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想点击按钮显示popUp,然后在弹出窗口中显示一个gridview到列

这是我在页面财务中尝试的内容

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





我尝试过:



此页面工资>> < br $>



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>

推荐答案

您应该学习尽快使用调试器。而不是猜测你的代码在做什么,现在是时候看到你的代码执行并确保它完成你期望的。



调试器允许你跟踪执行逐行检查变量,你会看到它有一个停止做你期望的点。

调试器 - 维基百科,免费的百科全书 [ ^ ]

掌握Visual Studio 2010中的调试 - A初学者指南 [ ^ ]



请注意,您的弹出窗口位于 IF 结构中,如果条件如果不满足,则不会显示。

使用调试器检查e变量值并检查条件是否满足。
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.


这篇关于弹出窗口中的gridview显示。但它没有填充数据(月,薪水)....? ! ! !我正在编辑代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆