解决方案 »
- seeion的Bug是什么,微软是怎么解决的?
- 请教checkboxlist选中取不到值?
- 请教FormsAuthenticationTicket的UserData中才存储数据
- 200分求Aspose.word 2.5以上的注册机(现在只能放100,下次再加)
- 100分求教 2个 问题 !!!高手请进!!!
- 有关一个ASP.NET中的权限的问题(请高手来帮帮忙)
- 有人帮我看看这种错误提示信息,一般是哪里出错了,
- 网站多了一串字符串
- ■ 最简单的分页显示 ACCESS 数据库, 问题是……
- 绝对困难的问题----web应用中如何实现数字签名技术??
- [windows service]帮忙分析哪种解决方案更好?
- 关于asp.net网页中 实现在线的pdf查看
Protected catalog As ListDictionary
Protected saleitem As ListDictionary
Protected returnValue As String
Protected validationTxtbox As String = "txtbox" Overloads Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim evt_ref As String = Page.ClientScript.GetCallbackEventReference(Me, Chr(34) & "param|" & validationTxtbox & Chr(34), "ReceiveServerData", Chr(34) & validationTxtbox & Chr(34))
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
validationTxtbox, _
"function txtbox_keypress() { " & _
" alert('start'); " & evt_ref & " ;}", True)
txtbox.Attributes.Add("onkeypress", "txtbox_keypress()")
End Sub
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
Dim argParts() As String = eventArgument.Split("|"c)
If ((argParts Is Nothing) OrElse (argParts.Length <> 2)) Then
returnValue = "A problem occurred trying to retrieve stock count."
Return
End If Dim product As String = argParts(0)
Dim validationaction = argParts(1)
Select Case validationaction
Case "txtbox"
Try
Page.ClientScript.ValidateEvent("txtbox_keypress", validationaction)
txtbox.Text = "google"
Catch
returnValue = "Can not retrieve sale status."
End Try End Select
End Sub Public Function GetCallbackResult() _
As String Implements _
System.Web.UI.ICallbackEventHandler.GetCallbackResult
Return returnValue
End Function
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Page.ClientScript.RegisterForEventValidation("txtbox_keypress", _
validationTxtbox)
MyBase.Render(writer)
End Sub
</script>
<script type ="text/javascript" >
function ReceiveServerData(rValue) {
//Results.innerText = rValue;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="txtbox_lb" runat="server" Text="txtbox1:"></asp:Label>
<asp:TextBox ID="txtbox" runat="server" ></asp:TextBox>
</div>
</form>
</body>
</html>
txtbox.Text = "google"
这个没有赋值成功
请问谁帮忙解答下,谢谢?
请问这是为什么??
(1)检查是否开通ViewState
(2)是否有多少赋值
(3)在IsPostBack后,是否在Page_Load里又重新赋值。
客户端的 txtbox 内容没有变化
服务端里面获取到的 txtbox.txt 仍然是空的
仍然存在如一楼提到的问题代码如二楼所示,当然没有多或少赋值
不知有谁能明白,请指导指导。
1. 如果想客户端回调服务端又需要刷新,用PostBackOptions 类----指定如何生成客户端 JavaScript 以启动回发事件。
以上是需要服务端刷新客户端2. 如果不需要服务端刷新客户端,则可以采用RaiseCallbackEvent 或者 用 ajax
1) RaiseCallbackEvent 方便调用服务端控件 ,不用写webservice
2)ajax不方便调用服务端控件,而且还要写webservice