Gridview中的复选框(Check box in Gridview)

   IT问题网   2020-06-27 00:00:00

问 题

如果我在gridview中选中复选框,那么如果我点击批准按钮,那个特定行应该插入approve_tbl。如果我检查2行或3或所有行只应插入数据库。

解决方案

在按钮点击事件中你必须像这样检查它



 受保护  void  insertintodbusingcheckbox()
{
for int i = 0 ; i lt; gridview1.rows.count; i ++)
{
if (((checkbox)gridview1.rows [i] .findcontrol(" 您的复选框id"))。选中== true
{
/ / 编写您的代码以插入数据库
}
}
}

您甚至可以在检查更改chekboxes时调用javascript函数并将有用值存储在hiddenfield中,然后在按钮上单击从隐藏字段中获取值,否则您也可以执行tejas在上述解决方案中所述的内容。

标签:中的复选



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

更新DatagridView记录(Updating DatagridView Records)

problem what am i doing wrong i can seem to u ...

如何从tortoiseSVN获取最新版本,然后使用CruiseControl.NET在msbuild中构建它(how to get latest version from tortoiseSVN and then build it in msbuild with CruiseControl.NET)

problem hi, i had a one asp.net solution in ...

请再帮忙,善良的人(Please help again, kind people)

problem hi all, so frustrated. i did two days'' researc ...

如何使用c#,net动态地在textarea中添加文本?(how to add text in textarea dynamically using c#,net)

problem string query = string.empty; query = "select mess ...

在Visual Studio 2010中创建Crystal Reports(Creating Crystal Reports in Visual Studio 2010)

problem im creating crystal reports using visual studio 2 ...

控制以填充数据并执行回发(control to fill the data and perform postback)

problem hi, is there any control to fill the data from da ...

System()vs CreateProcess()vs ShellExecute()(System() vs CreateProcess() vs ShellExecute())

problem here''s one for everyone, i''m running a batch fi ...

将TCL代码转换为C ++ ...(Convert a TCL code to C++...)

problem for {set i 128} {$ilt;256} {incr i 1} { eval lut ...

如何从二进制文件中读取浮点值(How Read Float value from Binary File)

problem hi. i do want to read float value from binary fi ...

使用.bak文件还原数据库(Restore Database using.bak file)

problem good evening everybody, please say how to restor ...

在gridview中显示总和(Show sum In gridview)

problem my gridview has data which looks like below (for ...

Ajax客户端脚本错误(Ajax Client side script error)

problem if (typeof(sys) === #39;undefined#39; ...

如何在UP和DOWN键进行编码(How to code at the UP and DOWN key)

problem i want to move picture box up and down when a use ...

如何计算excel 2003中的时间平均值(how to calculate time averge in excel 2003)

problem hii to all. if any body knows how to calculateave ...

控制相关问题(Control related issue)

problem respected sir, i have a page in which i m gettin ...

在运行时动态绘制div(draw div dynamically at runtime)

problem hiii all, i have a page which i draw all its attr ...

转换数据库值(Convert a databse value)

problem i have a table one field is price and ...

如何使单元格的内容可见为false(How do i make the content of a cell visible false)

problem how do i make the content of a cell visible false ...

qtwebkit并连接cpp和javascript(qtwebkit and connect cpp and javascript)

problem hi to all i am using qwebkit i have a cpp object ...

response.flush&到Response.End(problem with response.flush & response.end)

problem hello everybody, i have used response.flush() wi ...