Markup page <asp:FormView ID=”DefaultPhoto” runat=”server” DataKeyNames=”ge_id” DataSourceID=”ListPhotosDS”> <EditItemTemplate> <img src=”/images/< %# Container.DataItem("photo") %>” class=”detailsmallphoto”/> <asp:Label ID=”photo_idLabel” runat=”server” Text=’< %# Eval("photo_id") %>‘ Visible=”false” /> <asp:LinkButton ID=”UpdateButton” runat=”server” OnClientClick=”return confirm(‘Are you sure you want to remove this photo?’);” CommandName=”Update” /> </EditItemTemplate> </asp:FormView> Code behind DirectCast(DefaultPhoto.FindControl(“UpdateButton”), LinkButton).Text = “Remove” If Page.isPostBack Then DirectCast(DefaultPhoto.FindControl(“UpdateButton”), LinkButton).Text = “Add Photo” End […]
Archive for the 'Gridview' Tag
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>
VB.NET – Parameters
Parameter default value in code behind SQL Datasource <asp:sqldatasource ID=”ServiceExpired” runat=”server” ConnectionString=”< %$ ConnectionStrings:intranetConnectionString2 %>” SelectCommand=”SELECT * FROM [Invoice] _ WHERE _ ([EXPIRATION_DATE] >= @EXP_BEG) _ AND _ ([EXPIRATION_DATE] < @EXP_END) _ AND ([EXPIRATION_CONTACT] = @EXPIRATION_CONTACT) _ ORDER BY _ EXPIRATION_DATE "> <selectparameters> <asp:parameter DefaultValue=”YES” Name=”EXPIRATION_CONTACT” Type=”String” /> <asp:parameter Name=”EXP_BEG” Type=”DateTime”/> <asp:parameter Name=”EXP_END” Type=”DateTime”/> </selectparameters> […]