110,534
社区成员
发帖
与我相关
我的任务
分享
<html>
<script language="jscript" type="text/jscript">
function ClearAllTextBox() {
var obj = window.document.forms[0];
for (i = 0; i < obj.elements.length; i++) {
var elem = obj.elements[i];
if (elem) {
if (elem.type == "text") {
elem.value = "";
}
}
}
}
</script>
<head>
<title>项目管理</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="/Web/css/common.css"
type="text/css" />
</head>
<body>
<div id="man_zone">
<form id="engMachineForm" runat="server">
<input type="hidden" name="op" value="doLoadOne" />
<table width="70%" border="0" align="center" cellpadding="3"
cellspacing="1" class="table_style" >
<thead>
<tr>
<td class="left_title_header" colspan="2">
项目管理
</td>
</tr>
</thead>
<tbody>
<tr>
<td width="40%" class="left_title_2" style="text-align: center;">
项目编号
</td>
<td width="60%" class="left_title_2" style="text-align: left;">
<input type="text" id="txtBranchName" maxlength="10" value="" class="input_text" runat="server"/>
</td>
</tr>
</tbody>
<tfoot>
<tr bgcolor="#FFFFFF">
<td class="left_title_1" colspan="2"
style="text-align: left;padding-left:40%;">
<asp:Button ID="btnQuery" runat="server" Text="查询" CssClass="input_button" OnClick="btnQuery_Click" />
<input type="reset" value="清除" class="input_button" onclick="ClearAllTextBox">
</td>
</tr>
</tfoot>
</table>
<br />
<asp:GridView ID="gvProjInfo" CssClass="GridView" width="99%" border="0" cellpadding="3" cellspacing="1" BorderStyle="None" runat="server" AutoGenerateColumns="False" PageSize="6" AllowPaging="True" OnPageIndexChanging="gvProjInfo_PageIndexChanging" OnRowDataBound="gvProjInfo_RowDataBound">
<Columns>
<asp:BoundField DataField="First_kind_name" ItemStyle-Width="80px" HeaderText="项目编号" SortExpression="First_kind_name" >
<ItemStyle Width="80px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Customer_name" ItemStyle-Width="80px" HeaderText="客户名称" SortExpression="Customer_name" >
<ItemStyle Width="80px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="First_kind_CDate" ItemStyle-Width="100px" HeaderText="签约日期" SortExpression="First_kind_CDate" >
<ItemStyle Width="100px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="First_kind_DDate" ItemStyle-Width="100px" HeaderText="交货日期" SortExpression="First_kind_DDate" >
<ItemStyle Width="100px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="First_kind_SDate" ItemStyle-Width="100px" HeaderText="点火日期" SortExpression="First_kind_SDate" >
<ItemStyle Width="100px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="PM" ItemStyle-Width="80px" HeaderText="项目经理" SortExpression="PM" >
<ItemStyle Width="80px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Mech" ItemStyle-Width="180px" HeaderText="机械设计" SortExpression="Mech" >
<ItemStyle Width="180px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Elec" ItemStyle-Width="180px" HeaderText="电气设计" SortExpression="Elec" >
<ItemStyle Width="180px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Soft" ItemStyle-Width="180px" HeaderText="软件设计" SortExpression="Soft" >
<ItemStyle Width="180px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Stdtime" ItemStyle-Width="80px" HeaderText="标准工时" SortExpression="Stdtime" >
<ItemStyle Width="80px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Workhour" ItemStyle-Width="80px" HeaderText="已用工时" SortExpression="Workhour" >
<ItemStyle Width="80px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="descr" ItemStyle-Width="200px" HeaderText="项目描述" SortExpression="descr" >
<ItemStyle Width="200px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField>
<HeaderTemplate>
<input class="input_button" onclick="window.location = 'addOne.aspx'"
type="button" value="新增" />
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="linkEdit" runat="server" CommandArgument='<%# Eval("id") %>'
OnCommand="linkEdit_Command">编辑</asp:LinkButton>
<asp:LinkButton ID="linkDel" runat="server" CommandArgument='<%# Eval("id") %>' OnClientClick="return confirm('你确定要删除此用户吗?');" OnCommand="linkDel_Command" >删除</asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="80px" />
<ItemStyle Width="80px" />
</asp:TemplateField>
</Columns>
<PagerTemplate>
<table width="100%">
<tr>
<td align="right">
第<asp:Label ID="lblPageIndex" runat="server" Text='<%#((GridView)Container.Parent.Parent).PageIndex + 1 %>'></asp:Label>页
共<asp:Label ID="lblPageCount" runat="server" Text='<%#((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>页
每页<asp:Label ID="Label1" runat="server" Text='<%#((GridView)Container.Parent.Parent).PageSize %>'></asp:Label>条
<asp:LinkButton Text="首页" ID="btnFirst" runat="server" CausesValidation="false"
CommandArgument="First" CommandName="Page" />
<asp:LinkButton Text="上一页" ID="btnPre" runat="server" CausesValidation="false"
CommandArgument="Prev" CommandName="Page" />
<asp:LinkButton Text="下一页" ID="btnNext" runat="server" CausesValidation="false"
CommandArgument="Next" CommandName="Page" />
<asp:LinkButton Text="尾页" ID="btnLast" runat="server" CausesValidation="false"
CommandArgument="Last" CommandName="Page" />
</td>
</tr>
</table>
</PagerTemplate>
<PagerSettings PageButtonCount="5" Position="Bottom" Mode="NextPrevious"/>
<PagerStyle HorizontalAlign="Right"/>
</asp:GridView>
</form>
</div>
<p>
</p>
</body>
</html>
protected void gvProjInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='yellow';");
}
}
<!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<link href="Content/bootstrap.css" rel="stylesheet" />
<script src="Scripts/jquery-1.9.1.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
<style>
.table-hover > tbody > tr:hover {
background-color: #ff00dc;
}
</style>
</head>
然后,在你的 GridView 上设置启用鼠标悬停功能<asp:GridView ID="GridView1" runat="server" CssClass="table table-hover" ......
这就可以了。
<tr style="background-color: yellow;" onmouseover="this.style.backgroundColor='yellow';">