在A裡面透過建立一個事件,將 ChangePageSizeBySelect 讓 default.aspx能夠抓到事件,
讓default.aspx能夠抓到值,然後將值丟給B,做dropdownlist的databind
A.ascx.vb(裡面的dropdownlist 一定要做autopost back)
Public Property GetUC() As String
Get
GetUC = DropDownList1.SelectedValue
End Get
Set (value As String)
DropDownList1.SelectedValue = value
End Set
End Property
Public Delegate Sub UserControlEventHandler (ByVal sender As Object , ByVal str As String )
Public Event ChangePageSizeBySelect As UserControlEventHandler
Protected Sub DropDownList1_SelectedIndexChanged( ByVal sender As Object, ByVal e As System.EventArgs ) Handles DropDownList1.SelectedIndexChanged
RaiseEvent ChangePageSizeBySelect(Me , DropDownList1.SelectedValue)
End Sub
Default.aspx.vb
Protected Sub order_mainCus_code_ChangePageSizeBySelect(sender As Object , str As String ) Handles order_mainCus_code.ChangePageSizeBySelect
order_mainDiscus_customer.GetUC() = order_mainCus_code.GetUC()
End Sub
B.ascx.vb
Public Property GetUC() As String
Get
GetUC = DropDownList1.SelectedValue
End Get
Set (value As String)
Dim conn = New SqlConnection
Dim cmd As SqlCommand
Dim adapter As New SqlDataAdapter
Dim ds As New DataSet
Dim dt As New DataTable
Dim SqlString As String
conn.ConnectionString = System.Web.Configuration.WebConfigurationManager .ConnectionStrings( "ConnectionString").ConnectionString() '使用web config
SqlString = "select * from discus_customer where cus_code='" & value & "'"
'Label1.Text = SqlString
adapter = New SqlDataAdapter (SqlString, conn)
adapter.Fill(ds, "Discus_customer" )
DropDownList1.DataValueField = "discus_code"
DropDownList1.DataTextField = "discus_name"
DropDownList1.DataSource = ds.Tables( "Discus_customer" ).DefaultView
DropDownList1.DataBind()
Label1.Text = SqlString
End Set
End Property
總網頁瀏覽量
About
每次一句
Popular Posts
-
放了四天假,第一天上班 就看到Server出了點問題, 開工作管理員沒看到有吃大量記憶體的程式, 後來查到一篇, 黑暗執行緒-Windows記憶體都用到哪裡去了? 去抓了 RAMMap 來用,才發現所有的記憶體都被Drier Locked吃掉了,大約有4xG 看了幾篇文章 ...
-
前言 我也沒想到會寫到第二篇,第一篇是 [WIN10]非分頁集區記憶體暴增 改了regedit後還是沒用 , 這下只能去追看是哪個地方出問題了。 這邊會用到的工具有 poolmon跟 Windows Performance Analyzer(WPA)
-
目前環境為SQL Server 2016 但不知道多久之前,將資料庫備份到NAS的計畫排程就失敗了。 最近乖乖去查錯誤訊息(圖一),才發現 指定的路徑不正確(圖二)。 (圖一)
-
碎碎念 YT亂看的時候,看到有一個影片,再講如何獲取免費的office, 這其實不是新聞,但有問題的通常都是再破解上面, 可能被人惡意亂塞間諜程式或木馬。 但現在驗證救直接從官方來了
-
鉛淚結,如珠顆顆圓;移時驗,不曾一顆真。 不要再執著了,選擇放下吧.. 過了那麼久了,你到現在還是不明白, 你所要找的人並不是她, 你要找只是一個能夠陪陪你的人, 是一個當你孤單時還能夠陪你說說話, 出去散心的人..
Categories
.NET
小技巧
小說
文章分享
正規表示法
序列埠通訊
居家
拼圖
科學上網
逆向工程
偽文青
軟體
硬體
程式概念
逸品
雲端
試算表
資料庫
資訊安全
電影
演算法
網站心得
網路
機器學習
隨筆
鍵盤
雜事記錄
Android
ATOM
AutoIT
Blogger
Chrome
CSS
Dapper
dd-wrt
Debug
DevOops
DISM
DIY
Docker
Driver
Drone
EasyUI
ECK
EPPlus
EXCEL
FFmpeg
Flot Chart
GCP
Git
GKE
Golang
Google App Script
Grafana
IIS
iOS
istio
iTunes
JavaScript
jQuery
k8s
Katalon
Kubernetes
Line
LINQ
LinqToExcel
Linux
Log4Net
MAC
MailKit
Modbus
moment
MS SQL
MsChart
Nginx
NPOI
Nuget
OpenCV
OpenData
Oracle
PHP
Postgresql
powerBuilder
PowerShell
Prometheus
Python
Raspberry
Redis
ReportViwer
RPA
Scrapy
shellScript
SignalR
Solr
SQL CLR
SRE
SRS
Swagger
T-SQL
tampermonkey
Terraform
TFS
TypeScript
Ubuntu
USB安裝
VBA
VivoStick
VMware
VPN
VS Code
WebAPI
Windchill
Windows 10
Windows 7
Windows OS
Windows Server
WorePress
Xpath
Zookeeper