开发者

Getting posted value (ASP.NET)

开发者 https://www.devze.com 2023-02-13 23:25 出处:网络
I am building a DropDownList control dynamically. Constraining this discussion to within just the OnInit() method / state in the asp.net 开发者_JS百科lifecycle, is the only way to see the dropdownlis

I am building a DropDownList control dynamically.

Constraining this discussion to within just the OnInit() method / state in the asp.net 开发者_JS百科lifecycle, is the only way to see the dropdownlist's posted value to look at the Request.Form NameValueCollection?

I.e. Im aware that the dropdownlist's viewstate is restored by the time OnLoad() is reached, but I need it's value before then (im pretty sure LoadViewState($object) is of no use?)


try page_preload event to read viewstate

Private Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreLoad
        Dim s As String = DropDownList1.Text
End Sub


Other solution could be
Try this in Init event

VB

dim s as string = Request.Params("DropDownList1")

C#

string s = Request.Params["DropDownList1"];
0

精彩评论

暂无评论...
验证码 换一张
取 消