Home » Posts tagged "ASP.NET" (Page 15)

Archive for the 'ASP.NET' Tag

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] […]

Simple record query inside gridview

Here is simple record query inside the datagrid. I was looking for this solution which does not require code behind. Access DB structure Detail.aspx page code: <form id=“form1” runat=“server”> <div> <asp:GridView ID=”GridView1″ runat=”server” AutoGenerateColumns=”False” DataKeyNames=”ID” DataSourceID=”DetailView” GridLines=”None”> <Columns> <asp:TemplateField> <ItemTemplate> <table width=”660px” border=”0″ cellpadding=”0″ cellspacing=”0″> <tr> <td colspan=”4″> <a href=”Detail.aspx?cid=<%#Container.DataItem(“ID”)%>&pic=p1″><img src=”images/<%# Container.DataItem(“Pic1″)%>” width=”75px” height=”54px” border=”0″/></a>&nbsp; […]