void SEvent()
{
Response.Write("你好");
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#8EC26F'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
//设置悬浮鼠标指针形状为"小手"
e.Row.Attributes["style"] = "Cursor:hand";
//单击/双击 事件
e.Row.Attributes.Add("OnClick", "CEvent()");
//注:OnClick参数是指明为鼠标单击时间,后个是调用javascript的ClickEvent函数
}
}CEvent前臺代碼省略了就onclick的CEvent是客户端事件 SEvent是服务端方法我也明白,我想要實現鼠標在GridView1上滑動時,選中的行變色,單擊該行時能觸發SEvent(因為我想要進行數據綁定),而不是客戶端事件
{
Response.Write("你好");
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#8EC26F'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
//设置悬浮鼠标指针形状为"小手"
e.Row.Attributes["style"] = "Cursor:hand";
//单击/双击 事件
e.Row.Attributes.Add("OnClick", "CEvent()");
//注:OnClick参数是指明为鼠标单击时间,后个是调用javascript的ClickEvent函数
}
}CEvent前臺代碼省略了就onclick的CEvent是客户端事件 SEvent是服务端方法我也明白,我想要實現鼠標在GridView1上滑動時,選中的行變色,單擊該行時能觸發SEvent(因為我想要進行數據綁定),而不是客戶端事件
{
Response.Write("你好");
}
这个事件应该是JS方法吧?
或
ajaxpro