asif shaikh

asif shaikh

  • 1.4k
  • 187
  • 7.9k

drop download through database in grid view for asp.net webpage using c#

May 7 2011 8:13 AM
Please solve My problem I am too much distrub this is not doing by myself so kindly check and make it solve please

I will be thankfull .............................


<%@
Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="GenderDataSource" Runat="server" SelectCommand="SELECT [genderId], [gender] FROM [Gender]"   ConnectionString="<%$ ConnectionStrings:Example_DB_CheckConnectionString %>"> </asp:SqlDataSource> <asp:GridView ID="GridView1" Runat="server" DataSourceID="SqlDataSource1" DataKeyNames="std_id" AutoGenerateColumns="False" AllowPaging="True" BorderWidth="1px" BackColor="White" CellPadding="3" BorderStyle="None" BorderColor="#CCCCCC"> <FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle> <PagerStyle ForeColor="#000066" HorizontalAlign="Left" BackColor="White"></PagerStyle> <HeaderStyle ForeColor="White" Font-Bold="True" BackColor="#006699"></HeaderStyle> <Columns> <asp:CommandField ShowEditButton="True"></asp:CommandField> <asp:BoundField ReadOnly="True" HeaderText="std_id" InsertVisible="False" DataField="std_id" SortExpression="std_id"> <ItemStyle HorizontalAlign="Center"></ItemStyle> </asp:BoundField> <asp:BoundField HeaderText="std_name" DataField="std_name" SortExpression="std_name"></asp:BoundField> <asp:TemplateField SortExpression="gender" HeaderText="gender"> <EditItemTemplate> <asp:DropDownList ID="gender" runat="server" DataSourceID="GenderDataSource" DataTextField="gender" DataValueField="genderId" SelectedValue='<%#Bind("genderId")%>'> </asp:DropDownList> </EditItemTemplate> <ItemTemplate> <asp:Label Runat="server" Text='<%# Bind("gender") %>' ID="Label1"></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> <SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#669999"></SelectedRowStyle> <RowStyle ForeColor="#000066"></RowStyle> </asp:GridView>   <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Example_DB_CheckConnectionString2 %>" SelectCommand="SELECT student.std_id, student.std_name, student.std_fname, student.std_nic, Gender.gender FROM student INNER JOIN Gender ON student.genderId = Gender.genderId" UpdateCommand="UPDATE student SET std_name =@std_nam, std_fname =@std_fname, std_nic =@std_nic, genderId =@genderId where std_id=@std_id"> <UpdateParameters> <asp:Parameter Name="std_nam" /> <asp:Parameter Name="std_fname" /> <asp:Parameter Name="std_nic" /> <asp:Parameter Name="genderId" /> <asp:Parameter Name="std_id" /> </UpdateParameters> </asp:SqlDataSource> <br /> <asp:GridView ID="GridView2" runat="server"> </asp:GridView> <br /> <br /> <br /> <br /> <br />   </div> </form> </body> </html>



///////// StudentTable with reference of genderId /////////////////
CREATE TABLE [dbo].[student](
[std_id] [int] IDENTITY(1,1) NOT NULL,
[std_name] [varchar](50) NULL,
[std_fname] [varchar](50) NULL,
[std_nic] [varchar](50) NULL,
[genderId] [int] NULL,
 CONSTRAINT [PK_student] PRIMARY KEY CLUSTERED 
(
[std_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

//////////////////// GenderTable Male/Female
CREATE TABLE [dbo].[Gender](
[genderId] [int] IDENTITY(1,1) NOT NULL,
[gender] [nchar](10) NULL,
 CONSTRAINT [PK_Gender] PRIMARY KEY CLUSTERED 
(
[genderId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]



Answers (1)