Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a database with the details of student who have applied for a pass. The information of the student applied for the pass is shown to the staff in the form of a gridview, the staff should approve the gate pass or not approve the gate. This approval part is also added in the gridview, in the form of a textbox where the staff can type out approved or not. Once the staff click on the submit button the message alone should be passed to the student profile who have applied for it. I tried it out using checkbox, list box, button to submit the information and pass it. But I am not able to do it. Also the approval part need to be stored in my database. I am not sure of what to be done in the code behind.

What I have tried:

This is my design page

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="stafflogin.aspx.cs" Inherits="gatepass.stafflogin" %>





    <title>


    
          <div>
       
        <br><br>
        <div>
            
        </div>
        
        
        <center>
        <asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" backcolor="LightGoldenrodYellow" style="margin-right: 190px" width="680px" autogenerateeditbutton="True" datakeynames="regno" datasourceid="SqlDataSource1" onselectedindexchanged="GridView1_SelectedIndexChanged">
            <columns>
                 <asp:boundfield datafield="regno" headertext="regno" sortexpression="regno" readonly="True">
                 <asp:boundfield datafield="reason" headertext="reason" sortexpression="reason">
                 <asp:boundfield datafield="type" headertext="type" sortexpression="type">
                 <asp:boundfield datafield="dol" headertext="dol" sortexpression="dol">
                 <asp:boundfield datafield="tol" headertext="tol" sortexpression="tol">
                 <asp:boundfield datafield="dor" headertext="dor" sortexpression="dor">
                 <asp:boundfield datafield="tor" headertext="tor" sortexpression="tor">
                
              <asp:templatefield headertext="Approval">
                  
                  <itemtemplate>
                      <asp:textbox id="tb1" runat="server">
                  
              

                <asp:templatefield headertext="Submit">
                    <itemtemplate>
                        <asp:button id="btn1" runat="server" text="Submit">
                    
                
             
            
        
            
           
            <br>
            <asp:label id="Label1" runat="server" text="">
         </center>

       
          <br>

    
   



This is my code behind

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;


namespace gatepass


{
    public partial class stafflogin : System.Web.UI.Page
    {
        SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;Integrated Security=True");
       
        protected void Page_Load(object sender, EventArgs e)
        { con.Open();
             string checkusr = "select * from day";
             SqlCommand cmd = new SqlCommand(checkusr, con);
             SqlDataReader reader = cmd.ExecuteReader();
             GridView1.DataSource = reader;
             GridView1.DataBind();
             con.Close(); 
        }
    }
}</div>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900