社区
VB
帖子详情
GridView view = sender as GridView
G13402045
2010-09-16 11:03:31
GridView view = sender as GridView这句话用VB.NET怎么写啊
...全文
88
2
打赏
收藏
GridView view = sender as GridView
GridView view = sender as GridView这句话用VB.NET怎么写啊
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
兔子-顾问
2010-09-16
打赏
举报
回复
http://www.developerfusion.com/tools/convert/csharp-to-vb/
兔子-顾问
2010-09-16
打赏
举报
回复
Dim view As GridView = CType(sender,GridView)
简单新闻管理系统v适合.net初学者
using System; using System.Data; using System.Data.SqlClient; using System.Configuration; 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; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object
send
er
, EventArgs e) { LoginAcc.LoginCheck(); if (!Page.IsPostBack) { DataBind(); } } void DataBind() { //string str = "select NewsId,Title,AddTime,
View
Count
er
from
View
Table ord
er
by AddTime desc"; SqlConnection conn = new SqlConnection(ConfigurationManag
er
.ConnectionStrings["ConnectionString"].ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("up_GetDetilNews", conn); cmd.CommandType = CommandType.StoredProcedure; DataSet ds = new DataSet(); SqlDataAdapt
er
da = new SqlDataAdapt
er
(cmd); da.Fill(ds,"result");
Grid
View
1.DataSource = ds.Tables["result"];
Grid
View
1.DataBind(); } protected void
Grid
View
1_PageIndexChanging(object
send
er
,
Grid
View
PageEventArgs e) { //
Grid
View
1.PageIndex = e.NewPageIndex;
Grid
View
theGrid =
send
er
as
Grid
View
; // ref
er
to the
Grid
View
int newPageIndex = 0; if (-2 == e.NewPageIndex) { // when click the "GO" Button TextBox txtNewPageIndex = null; //
Grid
View
Row pag
er
Row = theGrid.Controls[0].Controls[theGrid.Controls[0].Controls.Count - 1] as
Grid
View
Row; // ref
er
to Pag
er
Template
Grid
View
Row pag
er
Row = theGrid.BottomPag
er
Row; //
Grid
View
较DataGrid提供了更多的API,获取分页块可以使用BottomPag
er
Row 或者TopPag
er
Row,当然还增加了Head
er
Row和Foot
er
Row //updated at 2006年6月21日3:15:33 if (null != pag
er
Row) { txtNewPageIndex = pag
er
Row.FindControl("txtNewPageIndex") as TextBox; // ref
er
to the TextBox with the NewPageIndex value } if (null != txtNewPageIndex) { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex } } else { // when click the first, last, previous and next Button newPageIndex = e.NewPageIndex; } // check to prevent form the NewPageIndex out of the range newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex; // specify the NewPageIndex theGrid.PageIndex = newPageIndex; // rebind the control // in this case of retrieving the data using the xxxDataSoucr control, // just do nothing, because the asp.net engine binds the data automatically // 别忘了重新绑定 DataBind(); } protected void
Grid
View
1_RowDeleting(object
send
er
,
Grid
View
DeleteEventArgs e) { string strId = (
Grid
View
1.DataKeys[e.RowIndex].Value).ToString(); string delStr = "delete from
View
Table wh
er
e NewsId=" + strId; DbUtil.DbHelp
er
.ExecSqlNonQu
er
ry(delStr); DataBind(); MyUtil.CsHelp
er
.ExecJS("删除成功!", this); } }
利用
send
er
的Parent获取
Grid
View
中的当前行(获取
grid
view
的值)
获取
Grid
View
当行有好几个方法:1 加RowCommand事件中,判断请求的发出按钮控件名,根据传递的参数来获取当前行中我们需要的参数。2
Grid
View
设置datakeynames方式。以上方法实现不再累赘。 今天给大家介绍一种最方便,也最满足日常思维的好办法:采用控件事件的
send
er
的Parent来获取cell对象,再取cell的上级对象,也就是row对象了。简单吧! 示例如下:在第三列中放了一个模板列,放入了一个CheckBox,想法是在选中时,设置第四列Lable状态标识为“T”,取消选中时,第四列Lable状态标识清空 CheckBox直接在模板列中双击,加入以下代码即可。
Android 仿饿了么加入购物车特效控件(自定义
View
实战)
利用 纯自定义
View
,实现的仿饿了么加入购物车控件,自带闪转腾挪动画的按钮。
grid
view
显示图片的实例代码
1.将图片以二进制存入数据库 2.读取二进制图片在页面显示 3.设置Image控件显示从数据库中读出的二进制图片 4.
Grid
View
中ImageField以URL方式显示图片 5.
Grid
View
显示读出的二进制图片 ==================== 1.将图片以二进制存入数据库 代码如下://保存图片到数据库 protected void Button1_Click(object
send
er
, EventArgs e) { //图片路径 string strPath = “~/photo/03.JPG”; string strPhotoPath = S
er
ve
asp.net 获取
Grid
view
隐藏列的值
在
Grid
view
的 RowCreated事件中书写如下代码: 代码如下: void
Grid
View
1_RowCreated(object
send
er
,
Grid
View
RowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Head
er
) { //隐藏第1列 e.Row.Cells[0].Visible = false; //可以根据需要隐藏更多的列 } } 因为在RowCreated事件(隐藏)在绑定时候发生,所以这样就即能将数
VB
16,555
社区成员
110,528
社区内容
发帖
与我相关
我的任务
VB
VB技术相关讨论,主要为经典vb,即VB6.0
复制链接
扫一扫
分享
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章