The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: FormView control Templates in ASP.NET 2.0
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
SharmilaPosted Dec 21, 2009, 1:37 PM
Hi, How to upload and display image thru formview control? I tried lot but its neither giving me error nor displaying image. In Sql database I have stored image with Image field type. <asp:FormView ID="frmProfile" runat = "server" DataSourceID ="SqlDataSource1"> <ItemTemplate > <table border ="0"> <tr><td><asp:LinkButton ID="lnkEdit" runat ="server" Text="Edit" CausesValidation ="false" CommandName ="Edit" /></td> </tr><tr><td><asp:Image ID="imgProfile" runat ="server" ImageUrl ='<%# Eval("photo")%>' AlternateText ="Not Available" /></td> </ItemTemplate> <EditItemTemplate > <table border ="0"> <tr><td><asp:LinkButton ID="lnkUpdate" runat="server" Text="Update" CausesValidation ="true" CommandName ="Update" /> </td> <td><asp:LinkButton ID="lnkCancel" runat ="server" Text="Cancel" CausesValidation ="false" CommandName ="Cancel" /></td></tr> <hr /> <tr><td><asp:Image ID="imgProfileEdit" Width = "150" Height = "125" ImageUrl ='<%# Eval("photo")%>' runat = "server" AlternateText ="Not Available" /> </td> </table> </EditItemTemplate> </asp:FormView> <asp:SqlDataSource ID="SqlDataSource1" runat ="server" ConnectionString ="<%$ ConnectionStrings:cnnvastu %>" SelectCommand ="LoadData" UpdateCommand ="updateProfile" UpdateCommandType ="StoredProcedure" SelectCommandType="StoredProcedure"> my VB code is - Public Sub frmProfile_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmProfile.DataBound Dim row As FormViewRow = frmProfile.Row Dim rowview As DataRowView = CType(frmProfile.DataItem, DataRowView) Dim profilePhoto As Image = Nothing Select Case frmProfile.CurrentMode Case FormViewMode.ReadOnly profilePhoto = CType(row.FindControl("imgProfile"), Image) Case FormViewMode.Edit profilePhoto = CType(row.FindControl("imgProfileEdit"), Image) Case Else End Select If profilePhoto IsNot Nothing Then profilePhoto.ToolTip = "Not Available" End If End Sub Let me know why its not working.. its displaying AlternateText every time.
Narayan GadekarPosted Aug 20, 2008, 6:30 AM
please send me Formview edit,update,delete Code Sample in vb.net by using connection string,command objects.
zeeshan saleemPosted Aug 16, 2008, 6:42 AM
I need a example of form view in which i want to calculate some integer values i.e i put calues in two fields and sum of the two fields autometically display in the 3rd feild.... Plz send me that example ........... Thanx
charanpreet singhPosted Mar 20, 2008, 3:08 AM
please send me the example of form view control in c#. thanks & regards charanpreet