Test.aspx <html xmlns=”http://www.w3.org/1999/xhtml”> <head runat=”server”> </head> <body> <form id=”form1″ runat=”server”> < %= Me.UpdMsg %> </form> </body> </html> Test.aspx.vb Protected UpdMsg As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)Handles Me.Load If Page.IsPostBack Then UpdMsg = “<a href=’#’ onClick=’parent.location.reload(1)’>Close!</a>” End If End Sub
Archive for the 'Applications' Category
Form control state in code behind
On page load event we define button css properties Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ‘define control css ValidatUser.Attributes.Add(“class”, “btnSubmit”) vUsername.Attributes.Add(“class”, “txtBox”) ‘on post back page we change the state of control If Page.IsPostBack Then ‘hide validate button ValidateUser.Visible = False ‘disable textbox vUsername.Enabled = False End If End […]
Record Update Confirmation Message
DataSource connection string <asp:sqldatasource ID=”MySQLDS” runat=”server” ConnectionString=”< %$ ConnectionStrings:MyConnString %>” UpdateCommand=”UPDATE [MyTablel] SET [DATE_SUBMITTED] = @DATE_SUBMITTED WHERE [RID] = @RID” OnUpdated=”UpdateMessage” > </asp:sqldatasource> VB code in a head section of the page <head> <script runat=”server”> Sub UpdateMessage(ByVal source As Object, ByVal e As SqlDataSourceStatusEventArgs) If e.AffectedRows > 0 Then ‘ Perform any additional processing, ‘ […]