Display image in Detailsvew control....
-
Hi, I have never used this control.Cay any one tell me:- 1) how to display image in detailsview control.I have store that image path in database.I want to display that image using the path store in that database. 2) and i want to hide columns of the detailsview control.Is it possible?.If yes how it is possible. Can any one provide me the example..........if possible. Thanks in advance. Regards, Pranav.
Pranav Dave
-
Hi, I have never used this control.Cay any one tell me:- 1) how to display image in detailsview control.I have store that image path in database.I want to display that image using the path store in that database. 2) and i want to hide columns of the detailsview control.Is it possible?.If yes how it is possible. Can any one provide me the example..........if possible. Thanks in advance. Regards, Pranav.
Pranav Dave
Put this code in .aspx page <asp:DataList ID="dataListImages" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" Width="100%" CellPadding="2" CellSpacing="0"> <ItemTemplate> <img alt="" src='<%#DataBinder.Eval(Container.DataItem, "Image_Path")%>' /> </ItemTemplate> </asp:DataList> In code behind .cs file private void BindDataList() { using (SqlConnection connection = new SqlConnection("Database=DOTNET;Server=HELLO-COMP;Integrated Security=SSPI")) { string queryString = "SELECT Image_Path FROM Image_Table"; SqlCommand command = new SqlCommand(queryString, connection); SqlDataAdapter da = new SqlDataAdapter(command); DataTable dt = new DataTable(); da.Fill(dt); dataListImages.DataSource = dt; dataListImages.DataBind(); } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindDataList(); } }