Code Behind Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) ‘ make a reference to a directory Dim DirPath As New IO.DirectoryInfo(“C:\\My_Website\My_Folder”) Dim FCollect As IO.FileInfo() = DirPath.GetFiles() Dim FInfo As IO.FileInfo ‘list the names of all files in the specified directory For Each FInfo In FCollect ‘bind url to line item – […]
Archive for the 'Controls' 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 […]
Delete confirm message – VB.NET
Delete confirm message when deleting record in GridView <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID=”LinkButton1″ Runat=”server” OnClientClick=”return confirm(‘Are you sure you want to delete this record?’);” CommandName=”Delete”>Delete </ItemTemplate> </asp:TemplateField>