62,047
社区成员
发帖
与我相关
我的任务
分享
<asp:GridView ID="GV_Humiture" runat="server"
Height="10px" Width="100%" AutoGenerateColumns="False" OnRowDataBound="GV_Humiture_RowDataBound" OnRowCreated="GV_Humiture_RowCreated" BackColor="White" CssClass="font11" BorderColor="#ABC5E0" >
<FooterStyle BackColor="White" ForeColor="#001F42" BorderColor="#ABC5E0" BorderWidth="1px" />
<Columns>
<asp:BoundField DataField="Date" HeaderText="日期" >
<HeaderStyle BorderColor="#001F42" Font-Bold="False" />
<ItemStyle ForeColor="#001F42" Width="6%" />
</asp:BoundField>
<asp:BoundField DataField="am_Dry" HeaderText="干(℃)" >
<ItemStyle ForeColor="#001F42" Width="12%" />
</asp:BoundField>
<asp:BoundField DataField="am_Wet" HeaderText="湿(℃)" >
<ItemStyle ForeColor="#001F42" Width="12%" />
</asp:BoundField>
<asp:BoundField DataField="am_Humidity" HeaderText="相对湿度(%)" >
<ItemStyle ForeColor="#001F42" Width="19%" />
</asp:BoundField>
<asp:BoundField DataField="pm_Dry" HeaderText="干(℃)" >
<ItemStyle ForeColor="#001F42" Width="12%" />
</asp:BoundField>
<asp:BoundField DataField="pm_Wet" HeaderText="湿(℃)" >
<ItemStyle ForeColor="#001F42" Width="12%" />
</asp:BoundField>
<asp:BoundField DataField="pm_Humidity" HeaderText="相对湿度(%)">
<ItemStyle ForeColor="#001F42" Width="19%" />
</asp:BoundField>
<asp:BoundField DataField="Note" HeaderText="备注" >
<ItemStyle ForeColor="#001F42" Width="7%" />
</asp:BoundField>
</Columns>
<AlternatingRowStyle BorderColor="#001F42" ForeColor="#001F42" />
<RowStyle Font-Names="Arial" ForeColor ="#ABC5E0" />
</asp:GridView>
protected override void Render(HtmlTextWriter writer)
{
foreach (GridViewRow Row in GridView1.Rows)
{
if (Row.RowType == DataControlRowType.DataRow)
{
//双击进入编辑模式
Row.Attributes["ondblclick"] = ClientScript.GetPostBackEventReference(GridView1, "Edit$" + Row.RowIndex.ToString(), true);
Row.Attributes["style"] = "cursor:pointer";
Row.Attributes["title"] = "双击进入编辑";
if (Row.RowState == DataControlRowState.Edit)
{
Row.Attributes.Remove("ondblclick");
Row.Attributes.Remove("style");
Row.Attributes["title"] = "编辑行";
for (Int32 i = 1; i < GridView1.Columns.Count; i++)
{
((TextBox)Row.Cells[i].Controls[1]).Attributes.Add("onmouseover", "this.select()");
}
//双击更新
Row.Attributes["ondblclick"] = ClientScript.GetPostBackEventReference(GridView1, "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 override void Render(HtmlTextWriter writer)
{
foreach (GridViewRow Row in GridView1.Rows)
{
if (Row.RowType == DataControlRowType.DataRow)
{
//双击进入编辑模式
Row.Attributes["ondblclick"] = ClientScript.GetPostBackEventReference(GridView1, "Edit$" + Row.RowIndex.ToString(), true);
Row.Attributes["style"] = "cursor:pointer";
Row.Attributes["title"] = "双击进入编辑";
if (Row.RowState == DataControlRowState.Edit)
{
Row.Attributes.Remove("ondblclick");
Row.Attributes.Remove("style");
Row.Attributes["title"] = "编辑行";
for (Int32 i = 1; i < GridView1.Columns.Count; i++)
{
((TextBox)Row.Cells[i].Controls[1]).Attributes.Add("onmouseover", "this.select()");
}
//双击更新
Row.Attributes["ondblclick"] = ClientScript.GetPostBackEventReference(GridView1, "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 override void Render(HtmlTextWriter writer)
{
foreach (GridViewRow Row in GridView1.Rows)
{
if (Row.RowType == DataControlRowType.DataRow)
{
//双击进入编辑模式
Row.Attributes["ondblclick"] = ClientScript.GetPostBackEventReference(GridView1, "Edit$" + Row.RowIndex.ToString(), true);
Row.Attributes["style"] = "cursor:pointer";
Row.Attributes["title"] = "双击进入编辑";
if (Row.RowState == DataControlRowState.Edit)
{
Row.Attributes.Remove("ondblclick");
Row.Attributes.Remove("style");
Row.Attributes["title"] = "编辑行";
for (Int32 i = 1; i < GridView1.Columns.Count; i++)
{
((TextBox)Row.Cells[i].Controls[1]).Attributes.Add("onmouseover", "this.select()");
}
//双击更新
Row.Attributes["ondblclick"] = ClientScript.GetPostBackEventReference(GridView1, "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);
}