如何在网格视图中使用select命令在其他页面上发送消息?

时间:2019-03-11 14:36:42

标签: c# .net sql-server visual-studio-2017

<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>

我在网格视图中接受了两个选择命令,一个是接受,另一个是拒绝。因此,我需要在不同页面而不是同一页面上显示消息。当用户单击接受时,它应显示已接受消息,而在拒绝时,它应显示拒绝。但是我没有逃脱如何做的事情,因为我没有在网格视图中使用模板。因此,我谦虚地寻求帮助。

0 个答案:

没有答案