Chiranjeevi Aripaka

Chiranjeevi Aripaka

  • NA
  • 133
  • 304.2k

DISPLAYING IMAGE IN GRID VIEW

Nov 27 2012 1:12 AM
COPY THE BELOW CODE AND MAINTAIN A DABASE WITH THE FIELDS THAT ARE THERE IN THE GIVEN CODE    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"                           Font-Bold="True" Font-Names="Arial" Height="38px" Width="200px"                               onselectedindexchanged="DropDownList1_SelectedIndexChanged">                          <asp:ListItem>SELECT STATE</asp:ListItem>                          <asp:ListItem>ANDHRA PRADESH</asp:ListItem>                          <asp:ListItem>BHOPAL</asp:ListItem>                          <asp:ListItem>ODISSA</asp:ListItem>                          <asp:ListItem>JAMMU</asp:ListItem>                          <asp:ListItem>BIHAR</asp:ListItem>                      </asp:DropDownList>                      </center>                          <br />                          <table align="center" cellpadding="2" class="style1">                              <tr>                                  <td align="center">                                      <asp:GridView ID="GridView1" runat="server" AllowPaging="True"                                           AutoGenerateColumns="False" DataKeyNames="REGDNO"                                           DataSourceID="SqlDataSource1" CellPadding="4" Font-Bold="True"                                           Font-Names="Arial" ForeColor="#333333" GridLines="None" Font-Size="11pt"                                           AllowSorting="True" Width="880px">                                          <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />                                          <Columns>                                          <asp:TemplateField HeaderText="STUDENT IMAGE">                                                  <EditItemTemplate>                                                  </EditItemTemplate>                                                  <ItemTemplate>                                                      <asp:Image ID="Image2" runat="server" Height="100"                                                           ImageUrl=''<%# Bind("IMG") %>'' Width="100" />                                                  </ItemTemplate>                                              </asp:TemplateField>                                              <asp:CommandField ShowEditButton="True" />                                              <asp:BoundField DataField="REGDNO" HeaderText="REGDNO" ReadOnly="True"                                                   SortExpression="REGDNO" />                                              <asp:BoundField DataField="STDNAME" HeaderText="STDNAME"                                                   SortExpression="STDNAME" />                                              <asp:BoundField DataField="STATE" HeaderText="STATE" SortExpression="STATE" />                                              <asp:BoundField DataField="IMG" HeaderText="IMG" SortExpression="IMG" />                                          </Columns>                                          <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />                                          <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />                                          <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />                                          <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />                                          <AlternatingRowStyle BackColor="White" />                                      </asp:GridView>    </td></tr></table>                                  <asp:SqlDataSource ID="SqlDataSource1" runat="server"                                           ConflictDetection="CompareAllValues"                                           ConnectionString="<%$ ConnectionStrings:ConnectionString %>"                                           DeleteCommand="DELETE FROM [STD_DETAILS] WHERE [REGDNO] = @original_REGDNO AND [STDNAME] = @original_STDNAME AND (([STATE] = @original_STATE) OR ([STATE] IS NULL AND @original_STATE IS NULL)) AND (([IMG] = @original_IMG) OR ([IMG] IS NULL AND @original_IMG IS NULL))"                                           InsertCommand="INSERT INTO [STD_DETAILS] ([REGDNO], [STDNAME], [STATE], [IMG]) VALUES (@REGDNO, @STDNAME, @STATE, @IMG)"                                           OldValuesParameterFormatString="original_{0}"                                           SelectCommand="SELECT [REGDNO], [STDNAME], [STATE], [IMG] FROM [STD_DETAILS] WHERE ([STATE] = @STATE)"                                           UpdateCommand="UPDATE [STD_DETAILS] SET [STDNAME] = @STDNAME, [STATE] = @STATE, [IMG] = @IMG WHERE [REGDNO] = @original_REGDNO AND [STDNAME] = @original_STDNAME AND (([STATE] = @original_STATE) OR ([STATE] IS NULL AND @original_STATE IS NULL)) AND (([IMG] = @original_IMG) OR ([IMG] IS NULL AND @original_IMG IS NULL))">                                          <SelectParameters>                                              <asp:ControlParameter ControlID="DropDownList1" Name="STATE"                                                   PropertyName="SelectedValue" Type="String" />                                          </SelectParameters>                                          <DeleteParameters>                                              <asp:Parameter Name="original_REGDNO" Type="String" />                                              <asp:Parameter Name="original_STDNAME" Type="String" />                                              <asp:Parameter Name="original_STATE" Type="String" />                                              <asp:Parameter Name="original_IMG" Type="String" />                                          </DeleteParameters>                                          <UpdateParameters>                                              <asp:Parameter Name="STDNAME" Type="String" />                                              <asp:Parameter Name="STATE" Type="String" />                                              <asp:Parameter Name="IMG" Type="String" />                                              <asp:Parameter Name="original_REGDNO" Type="String" />                                              <asp:Parameter Name="original_STDNAME" Type="String" />                                              <asp:Parameter Name="original_STATE" Type="String" />                                              <asp:Parameter Name="original_IMG" Type="String" />                                          </UpdateParameters>                                          <InsertParameters>                                              <asp:Parameter Name="REGDNO" Type="String" />                                              <asp:Parameter Name="STDNAME" Type="String" />                                              <asp:Parameter Name="STATE" Type="String" />                                              <asp:Parameter Name="IMG" Type="String" />                                          </InsertParameters>                                      </asp:SqlDataSource>

Answers (1)