曾俊的博客
Where there is a will , there is a way .有志者,事竟成...
登录
注册
全站
当前博客
空间
博客
好友
相册
留言
曾俊
ID:zengjun24
共
1781
次访问,排名
2万外
好友
10
人,关注者
18
人
乐于研究技术,主攻Asp.net C#语言Web开发
zengjun24的文章
原创 11 篇
翻译 0 篇
转载 0 篇
评论 4 篇
最近评论
zengjun24:
谢谢你的提醒:
private void getDataNode(string ParentID,TreeNode Node)
...{
BindNode(getChindNode(ParentID), Node.ChildNodes); //向结点填充数据.
}
你上面所指的的Node是一个Chi……
fly_to_the_winds:
兄弟,你的代码有个地方错勒:填充节点的方法里面
private void BindNode(DataTable dt ,TreeNodeCollection Node)
{
...
//Node.Add(NewNode); --就吱点错
Node.Nodes.Add(NewNode);
}
zengjun24:
__doPostBack()方法是Javascript 的一个函数。用来触发页面的PostBack事件
xieyours:
你的_doPostBack() 方法呢?可以贴出来吗
文章分类
收藏
相册
存档
2008年09月(2)
2008年03月(1)
2008年02月(2)
2007年12月(1)
2007年10月(1)
2007年09月(4)
软件项目交易
订阅我的博客
GridView行选择事件,单击GridView中某一行任意位置提出这条记录
收藏
新一篇: Javascript实现日期的连动选择
|
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.Data.SqlClient;
public
partial
class
DataViewSelectRow : System.Web.UI.Page
...
{
protected
void
Page_Load(
object
sender, EventArgs e)
...
{
if
(
!
IsPostBack)
...
{
lblStr.Text
=
"
select * from Products
"
;
DataSet ds
=
BindSqlServer(lblStr.Text);
//
GridView1.DataSource
=
ds;
GridView1.DataBind();
}
}
private
DataSet BindSqlServer(
string
str)
...
{
SqlConnection Conn
=
new
SqlConnection(
"
server=.;uid =sa ; pwd=;database = northwind
"
);
DataSet ds
=
new
DataSet();
SqlDataAdapter da
=
new
SqlDataAdapter(str, Conn);
da.Fill(ds);
return
ds;
}
protected
void
GridView1_PageIndexChanging(
object
sender, GridViewPageEventArgs e)
...
{
GridView1.PageIndex
=
e.NewPageIndex;
DataSet ds
=
BindSqlServer(
"
select * from Products
"
);
GridView1.DataSource
=
ds;
GridView1.DataBind();
}
protected
void
GridView1_RowCreated(
object
sender, GridViewRowEventArgs e)
...
{
//
注册行单击事件
e.Row.Attributes.Add(
"
onclick
"
,
"
javascirpt:__doPostBack('GridView1','Select$
"
+
e.Row.RowIndex
+
"
')
"
);
}
protected
void
GridView1_SelectedIndexChanged(
object
sender, EventArgs e)
...
{
Response.Write(GridView1.SelectedValue);
//
显示单示列的ID
//
得到ID后将其付给一个变量
lblStr.Text
=
"
select * from products where Productid =
"
+
GridView1.SelectedValue;
DataSet ds
=
new
DataSet();
ds
=
BindSqlServer(lblStr.Text);
this
.TextBox1.Text
=
ds.Tables[
0
].Rows[
0
][
"
QuantityPerUnit
"
].ToString();
}
}
发表于 @
2007年09月27日 09:41:00
|
评论(
loading...
)
|
编辑
新一篇: Javascript实现日期的连动选择
|
评论
#
xieyours 发表于2008-05-23 22:54:56 IP: 59.57.10.*
你的_doPostBack() 方法呢?可以贴出来吗
#
zengjun24 发表于2008-05-25 11:57:10 IP: 221.221.152.*
__doPostBack()方法是Javascript 的一个函数。用来触发页面的PostBack事件
发表评论
姓 名:
主 页:
校验码:
看不清,换一张
登录