You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Shipping/FeeManagement.aspx.cs

102 lines
3.8 KiB
C#

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DSWeb.EntityDA;
namespace DSWeb.Shipping
{
public partial class FeeManagement : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindReceiveFeeGrid();
BindPayFeeGrid();
}
private void BindReceiveFeeGrid()
{
FeeDA feeDA = new FeeDA();
DataSet feeSet = feeDA.GetFeeList();
gv_receive.DataSource = feeSet.Tables[0];
gv_receive.DataBind();
}
private void BindPayFeeGrid()
{
FeeDA feeDA = new FeeDA();
DataSet feeSet = feeDA.GetFeeList();
gv_pay.DataSource = feeSet.Tables[0];
gv_pay.DataBind();
}
protected override void Render(HtmlTextWriter writer)
{
foreach (GridViewRow Row in gv_receive.Rows)
{
if (Row.RowType == DataControlRowType.DataRow)
{
//双击进入编辑模式
Row.Attributes["onclick"] = ClientScript.GetPostBackEventReference(gv_receive, "Edit$" + Row.RowIndex.ToString(), true);
Row.Attributes["style"] = "cursor:default";
Row.Attributes["title"] = "双击进入编辑";
if (Row.RowState == DataControlRowState.Edit)
{
//取消单击编辑时间,防止触发单击事件
Row.Attributes.Remove("onclick");
Row.Attributes.Remove("style");
Row.Attributes["title"] = "编辑行";
//for(int i = 0;i < gv_receive.Columns.Count;i++)
//{
// HtmlGenericControl htmlDvState = (HtmlGenericControl)Row.Cells[i].FindControl("dvFeeEditState");
// HtmlGenericControl htmlDvItemState = (HtmlGenericControl)Row.Cells[i].FindControl("dvFeeItemState");
// htmlDvState.InnerText = htmlDvItemState.InnerText;
//}
//for (Int32 i = 1; i < gv_receive.Columns.Count; i++)
//{
// ((TextBox)Row.Cells[i].Controls[1]).Attributes.Add("onmouseover", "this.select()");
//}
//双击更新
//for (int i = 1; i < gv_receive.Columns.Count; i++)
//{
// //HtmlGenericControl htmlDvState = (HtmlGenericControl)Row.Cells[i].Controls[1];
// //string val = htmlDvState.InnerText;
//}
//Row.Attributes["ondblclick"] = ClientScript.GetPostBackEventReference(gv_receive, "Update$" + Row.RowIndex.ToString(), true);
}
//
for (int i = 1; i < Row.Cells.Count; i++)
{
Page.ClientScript.RegisterForEventValidation(Row.UniqueID + "$ctl00", i.ToString());
}
}
}
base.Render(writer);
}
protected void gv_receive_RowEditing(object sender, GridViewEditEventArgs e)
{
gv_receive.EditIndex = e.NewEditIndex;
gv_receive.DataBind();
}
protected void gv_pay_RowEditing(object sender, GridViewEditEventArgs e)
{
gv_pay.EditIndex = e.NewEditIndex;
gv_pay.DataBind();
}
}
}