Q:

How to send message on different page using the select command in grid view?

<div class="row" style="color:black">
        <div class="col">
            <asp:GridView ID="GridView1" runat="server" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" CssClass="table-bordered table-hover table-responsive table" BackColor="White" BorderColor="White" CellPadding="3" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" >
                <AlternatingRowStyle BackColor="#CCCCCC" />
                <Columns>
                    <asp:CommandField ShowSelectButton="True" SelectText="Accept" ControlStyle-ForeColor="Green" />
                    <asp:CommandField ShowDeleteButton="true" DeleteText="Reject" ControlStyle-ForeColor="Red"/>

                    <asp:BoundField DataField="first_name" HeaderText="first_name" SortExpression="first_name" />
                    <asp:BoundField DataField="last_name" HeaderText="last_name" SortExpression="last_name" />
                    <asp:BoundField DataField="c_email" HeaderText="c_email" SortExpression="c_email" />
                    <asp:BoundField DataField="contact" HeaderText="contact" SortExpression="contact" />
                    <asp:BoundField DataField="licenseno" HeaderText="licenseno" SortExpression="licenseno" />
                    <asp:BoundField DataField="v_name" HeaderText="v_name" SortExpression="v_name" />
                    <asp:BoundField DataField="v_company" HeaderText="v_company" SortExpression="v_company" />
                    <asp:BoundField DataField="v_plate" HeaderText="v_plate" SortExpression="v_plate" />
                    <asp:BoundField DataField="wheeler" HeaderText="wheeler" SortExpression="wheeler" />
                    <asp:BoundField DataField="damage_Details" HeaderText="damage_Details" SortExpression="damage_Details" />
                    <asp:BoundField DataField="street" HeaderText="street" SortExpression="street" />
                    <asp:BoundField DataField="landmark" HeaderText="landmark" SortExpression="landmark" />
                    <asp:BoundField DataField="pincode" HeaderText="pincode" SortExpression="pincode" />
                </Columns>
                <FooterStyle BackColor="#CCCCCC" />
                <HeaderStyle BackColor="#752c82" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#F1F1F1" />
                <SortedAscendingHeaderStyle BackColor="#808080" />
                <SortedDescendingCellStyle BackColor="#CAC9C9" />
                <SortedDescendingHeaderStyle BackColor="#383838" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Tazzac.mdf;Integrated Security=True" ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerReg.first_name, CustomerReg.last_name, CustomerReg.c_email, CustomerReg.contact, CustomerReg.licenseno, vehicle_detail.v_name, vehicle_detail.v_company, vehicle_detail.v_plate, vehicle_detail.wheeler, ServiceInfo.damage_Details, ServiceInfo.street, ServiceInfo.landmark, ServiceInfo.pincode FROM CustomerReg CROSS JOIN vehicle_detail INNER JOIN ServiceInfo ON CustomerReg.c_email = ServiceInfo.c_email AND vehicle_detail.v_plate = ServiceInfo.v_plate WHERE (ServiceInfo.email = @email)">
                <SelectParameters>
                    <asp:SessionParameter Name="email" SessionField="mechanic" />
                </SelectParameters>
            </asp:SqlDataSource>
        </div>
    </div>

I have taken two select commands in my grid view, one is accept and other is reject. So, I need to display message on different page not the same page. As the user clicks on accept it should display message as accepted and on reject it should display reject. But i am not getting away how to do it as I have not taken template in grid view. So I humbly request for help in it.

A:

Since your question is only about "send a message on a different page using select command" One way to achieve this is using session variables within C# .NET application.
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{           
    String strStatus = "Accepted";
        Session["key1"] = strStatus;

        string BrowserSettings = "status=no,toolbar=no,menubar=no,location=no,resizable=no," +
                                    "titlebar=no, addressbar=no, width=600 ,height=750";
        string URL = "StatusWebForm.aspx";
        string scriptText = "window.open('" + URL + "','_blank','" + BrowserSettings + "');";
        ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ClientScript1", scriptText, true);
}

This ScriptManager concept was answered by Mahantesh, so I want to give him credit for that.
On second WebForm (.aspx.cs) page where  you want to display the message, add a Label and Page_Load event.
public partial class StatusWebForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        String strStatus = (String)Session["key1"];
        lblStatus.Text = strStatus;
    }
}

