Home » Posts tagged "Gridview" (Page 2)

Archive for the 'Gridview' Tag

.NET Form/GridView Update Command Property

Insert this code right below <!DOCTYPE html PUBLIC “…..”> tag: Sub UpdateMessage(ByVal source As Object, ByVal e As SqlDataSourceStatusEventArgs) If e.AffectedRows > 0 Then ‘ Perform any additional processing, ‘ such as setting a status label after the operation. Label1.Text = “- Information updated successfully!” Else Label1.Text = “No data updated!” End If End Sub […]

GridView drop-down list record update:

Found this code on msdn library and use it all the time. Code is pretty straight forward and easy to implement and customizable. Have fun using it. <asp:TemplateField SortExpression=”CategoryName” HeaderText=”CategoryName”> <EditItemTemplate> <asp:DropDownList ID=”DropDownList1″ Runat=”server” DataSourceID=”categoryDataSource” DataTextField=”CategoryName” DataValueField=”CategoryID” SelectedValue='<%# Bind(“CategoryID”) %>’> </asp:DropDownList> </EditItemTemplate> <ItemTemplate> <asp:Label Runat=”server” Text='<%# Bind(“CategoryName”) %>’ ID=”Label1″></asp:Label> </ItemTemplate> </asp:TemplateField> For more related code […]

One click gridview record update

Here is how you can update record in a gridview with just a one click. Code: <asp:TemplateField HeaderText=”Active”> <ItemTemplate> <asp:CheckBox ID=”ActiveCheckBox” runat=”server” Checked='<%# Bind(“Active”) %>’ /> <asp:LinkButton ID=”UpdateButton” runat=”server” CausesValidation=”True” CommandName=”Update” Text=”Update” /> </ItemTemplate> <HeaderStyle CssClass=”datagrid-th” /> </asp:TemplateField> Access Data Source <asp:AccessDataSource ID=”RepoMgt” runat=”server” DataFile=”/my_folder/mydb.mdb” DeleteCommand=”DELETE FROM [MyCars] WHERE [ID] = ?” InsertCommand=”INSERT INTO [MyCars] […]