我有一个gridview,并且有一个超链接列,上面写着更新。单击该页面后,将重定向到另一个页面,并且特定的行值将显示在另一个网格视图中。并且用户需要编辑 1 列并使其更新,然后在 gridview 之外有一个发送或接受按钮,单击它时应该生成邮件,它应该采用更新的网格值并将其发送给他的其他用户和页面应该被重定向到上一页。
gridview的aspx代码
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="false" BackColor="White" BorderColor="#0061C1"
BorderStyle="None" CaptionAlign="Bottom" EmptyDataText="No Records Found"
Font-Names="Verdana" Font-Size="X-Small" ForeColor="#0061C1" Height="70px"
ShowFooter="True" ShowHeaderWhenEmpty="True" OnRowCommand="GridView1_RowCommand"
OnRowDataBound="GridView1_RowDataBound" OnRowEditing="GridView1_RowEditing"
onselectedindexchanged="GridView1_SelectedIndexChanged" OnRowUpdating="GridView1_RowUpdating"
Width="796px">
<Columns>
<asp:BoundField DataField="LeaveID" Visible="false">
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" HorizontalAlign="Center"
VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="10px" />
</asp:BoundField>
<asp:TemplateField HeaderText="Applied By">
<ItemTemplate>
<asp:Label
ID="LoggedInUser" runat="server" Font-Names="Verdana" Font-Size="X-Small"
Height="24px" Text='<%# Eval("LoggedInUser")%>' Width="100px"></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Begin Date">
<ItemTemplate>
<asp:Label
ID="BeginDate" runat="server" DataFormatString="{0:dd/MM/yyyy}"
Font-Names="Verdana" Text='<%# Eval("BeginDate","{0:dd/MM/yyyy}")%>' Font-Size="X-Small" Height="20px"
Width="100px"></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="End Date">
<ItemTemplate>
<asp:Label
ID="EndDate" runat="server" Font-Names="Verdana" Font-Size="X-Small"
Height="20px" Text='<%# Eval("EndDate","{0:dd/MM/yyyy}")%>' Width="100px"></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Num of Days">
<ItemTemplate>
<asp:Label
ID="NumofDays" runat="server" Font-Names="Verdana" Font-Size="X-Small"
Height="20px" Text='<%# Eval("NumofDays")%>' Width="100px"></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Type of Leave ">
<ItemTemplate>
<asp:Label
ID="LeaveType" runat="server" Font-Names="Verdana" Font-Size="X-Small"
Height="20px" Text='<%# Eval("TypeofLeave")%>' Width="100px"></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Label
ID="Status" runat="server" Font-Names="Verdana" Font-Size="X-Small"
ForeColor="Black" Height="20px" Text='<%# Eval("Status")%>' Width="100px"></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Reason for Reject">
<ItemTemplate>
<asp:Label ID="RejectReason"
runat="server" Font-Names="Verdana" Font-Size="X-Small" ForeColor="Black"
Height="20px" Text='<%# Eval("RejectReason")%>' Enabled="true" Visible="true" Width="100px"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtRejectReason"
runat="server" Font-Names="Verdana" Font-Size="X-Small" ForeColor="Black"
Height="20px" Text='<%# Eval("RejectReason")%>' Enabled="true" Visible="true" Width="100px"></asp:TextBox>
</EditItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="LogdInUser" Visible="false" >
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" HorizontalAlign="Center"
VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="Manager" Visible="false" >
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" HorizontalAlign="Center"
VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
</asp:BoundField>
<asp:CommandField ShowEditButton="true" ButtonType="Button" EditText="Edit">
<ControlStyle Width="50" />
</asp:CommandField>
</Columns>
</asp:GridView>
我需要编辑拒绝原因列。
cs页面
protected void Page_Load(object sender, EventArgs e)
{
MTMSDTO objc = new MTMSDTO();
if (!IsPostBack)
{
int LeaveID = 0;
int.TryParse(Request.QueryString["LeaveID"], out LeaveID);
objc.LeaveID = LeaveID;
objc.RejectReason = TxtRejectReason.Text;
DataSet lapp = obj.GetLeaveApproved(objc);
DataView LApp = new DataView();
LApp.Table = lapp.Tables[0];
GridView1.DataSource = LApp;
GridView1.DataBind();
}
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
GridView1.DataBind();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int LeaveID = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString());
TextBox TxtRejectReason = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TxtRejectReason");
GridView1.EditIndex = -1;
GridView1.DataBind();
}
一旦我单击gridview中的编辑按钮,它就不会显示任何记录
请帮我