Click here to Skip to main content
15,893,923 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralThis is the code Pin
haleemasher2-Jul-09 18:53
haleemasher2-Jul-09 18:53 
GeneralRe: This is the code Pin
padmanabhan N2-Jul-09 18:59
padmanabhan N2-Jul-09 18:59 
GeneralRe: This is the code Pin
haleemasher2-Jul-09 19:06
haleemasher2-Jul-09 19:06 
GeneralRe: This is the code Pin
himanshu25612-Jul-09 19:12
himanshu25612-Jul-09 19:12 
GeneralRe: This is the code Pin
haleemasher2-Jul-09 19:17
haleemasher2-Jul-09 19:17 
GeneralRe: This is the code Pin
padmanabhan N2-Jul-09 19:21
padmanabhan N2-Jul-09 19:21 
GeneralRe: This is the code Pin
K03062-Jul-09 19:25
K03062-Jul-09 19:25 
GeneralRe: This is the code Pin
haleemasher2-Jul-09 19:33
haleemasher2-Jul-09 19:33 
SqlConnection cnx = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|Coupon Management.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
        SqlDataAdapter da1 = new SqlDataAdapter();
        DataSet ds = new DataSet();
        SqlCommand cmd = new SqlCommand();
        DataTable dataTable;


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                FillVendorGrid();

            }
        }



      private void FillVendorGrid()
      {

          dataTable = new DataTable();

          cmd.Connection = cnx;

          cmd.CommandText = "SELECT CouponType.CouponName, Coupon_Info.Coupon_TypeID FROM CouponType INNER JOIN Coupon_Info ON CouponType.CouponTypeID = Coupon_Info.Coupon_TypeID";

          da1  = new SqlDataAdapter(cmd);

          da1.Fill(dataTable);
          GridView1.DataSource = dataTable;
          GridView1.DataSourceID = String.Empty;

      }
      protected void ResultGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
      {

        GridView1.PageIndex = e.NewPageIndex;

          FillVendorGrid();

      } protected void deleting(object sender, GridViewDeleteEventArgs e)
        {

            cmd.Connection = cnx;

            cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex][0] + "'";

            cnx.Open();

            cmd.ExecuteNonQuery();

            cnx.Close();

            FillVendorGrid();

        }


and asp code is
asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Coupon ManagementConnectionString2 %>" 
            
            SelectCommand="SELECT CouponType.CouponName, Coupon_Info.Coupon_TypeID FROM CouponType INNER JOIN Coupon_Info ON CouponType.CouponTypeID = Coupon_Info.Coupon_TypeID"></asp:SqlDataSource>

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" AutoGenerateDeleteButton="True" 
            AutoGenerateSelectButton="True" CellPadding="4" DataSourceID="SqlDataSource1" 
            ForeColor="#333333" GridLines="None" onrowdeleting="deleting" 
            
            style="z-index: 4; top: 425px; left: 280px; position: absolute; height: 312px; width: 691px">
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#E3EAEB" />
            <Columns>
                <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
                <asp:BoundField DataField="Coupon" HeaderText="Coupon" 
                    SortExpression="Coupon" />
                <asp:BoundField DataField="Serial Start" HeaderText="Serial Start" 
                    SortExpression="Serial Start" />
                <asp:BoundField DataField="Serial End" HeaderText="Serial End" 
                    SortExpression="Serial End" />
                <asp:BoundField DataField="Recieved By" HeaderText="Recieved By" 
                    SortExpression="Recieved By" />
            </Columns>
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#7C6F57" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>

GeneralRe: This is the code Pin
K03062-Jul-09 19:41
K03062-Jul-09 19:41 
GeneralRe: This is the code Pin
padmanabhan N2-Jul-09 19:49
padmanabhan N2-Jul-09 19:49 
GeneralRe: This is the code Pin
haleemasher2-Jul-09 20:06
haleemasher2-Jul-09 20:06 
Question[Message Deleted] Pin
N Ahmed2-Jul-09 12:26
N Ahmed2-Jul-09 12:26 
AnswerRe: Help Please !!! Pin
Not Active2-Jul-09 15:12
mentorNot Active2-Jul-09 15:12 
AnswerRe: Help Please !!! Pin
Christian Graus2-Jul-09 17:04
protectorChristian Graus2-Jul-09 17:04 
QuestionRegistration control? Pin
Hristiyan2-Jul-09 7:43
Hristiyan2-Jul-09 7:43 
AnswerRe: Registration control? Pin
Christian Graus2-Jul-09 8:18
protectorChristian Graus2-Jul-09 8:18 
GeneralRe: Registration control? Pin
Hristiyan2-Jul-09 8:22
Hristiyan2-Jul-09 8:22 
GeneralRe: Registration control? Pin
Christian Graus2-Jul-09 8:36
protectorChristian Graus2-Jul-09 8:36 
AnswerRe: Registration control? Pin
Svetlin Panayotov2-Jul-09 11:25
Svetlin Panayotov2-Jul-09 11:25 
QuestionPlay music file Pin
yesu prakash2-Jul-09 2:52
yesu prakash2-Jul-09 2:52 
AnswerRe: Play music file Pin
farhanjacky2-Jul-09 3:33
farhanjacky2-Jul-09 3:33 
GeneralRe: Play music file Pin
Manas Bhardwaj2-Jul-09 3:59
professionalManas Bhardwaj2-Jul-09 3:59 
GeneralRe: Play music file Pin
Abhijit Jana2-Jul-09 4:49
professionalAbhijit Jana2-Jul-09 4:49 
GeneralRe: Play music file Pin
Christian Graus2-Jul-09 8:16
protectorChristian Graus2-Jul-09 8:16 
AnswerRe: Play music file Pin
Christian Graus2-Jul-09 8:18
protectorChristian Graus2-Jul-09 8:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.