在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
-
通常會用到這個是,win7要安裝時,發生找不到滑鼠、鍵盤之類的驅動 怎麼把安裝光碟丟去usb就請自行google了,此篇偏向紀錄
-
如果只是主表下面拉一層明細(onExpandRow),easyui的官方網站就有介紹了。 參考 如果要拉兩層明細,同樣也有介紹( nested subgrid)。 參考 但由於第一次寫的時候是使用onExpandRow,懶得重改,就一頭下去了...
-
只能說...這OS寫的有待加強 我用的是Paperwhite 開啟的時候,正常都會出現 『滑動已解鎖Kindle』 但是就是沒這個字出現,一整個卡住。 後來查了一下,這不是偶發, 很多人都碰過了。 最後的解決方式是 用USB接電腦,電源按住30秒 重開後解決。 ...
-
前言: 最近迷上了用動畫的人物當桌面的布景,前陣子是科幻的設計圖。 但都同一個種類,所以不用分資料夾。 但動畫的人物一抓就是一堆,又不小心看到其他看過的喜歡人物,就分資料夾放好了。 依稀記得win7能夠直接抓資料夾底下的圖出來當桌布, ...
-
前言 總是撐到最後才報稅, 自然人憑證到期了, 之後又要換新的身份證, 這次就來用健保卡來報稅了。 健保卡的申請方式, 參考這篇 建議是使用手機app( 健保快易通) 申請(前提是手機是掛在你名字底下), 如果用電腦申請的話,需要戶口名簿的戶號... 環境 ...
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