用于在gridview中编辑单个单元格的代码 [英] Code for editing individual cells in gridview

查看:54
本文介绍了用于在gridview中编辑单个单元格的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想在gridview中编辑单个单元格,确切的是,当我单击gridview中的单元格时,它必须打开一个弹出式网页.

请帮帮我...

在此先感谢.......

谢谢,
Kiran

Hi,

I want to edit individual cells in gridview,what exactly i need is when i click on the cell in the gridview it must open a popup webpage.

Please help me...

Thanks in advance.......

Thanks,
Kiran

推荐答案



将字段更改为模板字段,添加一个linkbutton控件.
将链接按钮的文本绑定到原始列.

然后双击链接按钮,这将创建一个服务器端方法,您将在其中获得所需的字段值,如下所示.

字符串键=((LinkBut​​ton)sender).Text;
然后,您可以使用密钥进行server.transfer

另一种方法是创建一个加载第二页客户端的javascript语句.

您可以使用以下方法进行操作
受保护的void GridView1_RowDataBound(对象发送者,GridViewRowEventArgs e)

然后将属性添加到链接按钮,该属性将调用javascript以打开表单.
LinkBut​​ton1.Attributes.Add("onclick","...要加载页面的javascript ..." +键)

希望这为您指明了正确的方向...

问候,

Hi,

Change the field to a template field, add a linkbutton control.
Bind the text of the linkbutton to the original column.

Then double click on the link button which will create a serverside method where you get the required field value like shown below.

string key = ((LinkButton)sender).Text;
You can then server.transfer with the key

Another way is to create a javascript statement that loads the second page client side.

You can do this by using the following method
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

Then add an attribute to the linkbutton which calls javascript to open the form.
LinkButton1.Attributes.Add("onclick", "... javascript to load page... " + key)

hope this points you in a good direction...

regards,

Don




我尝试了一些符合您要求的代码.请检查一次

在代码下面的数据控制位置
Hi,

I tried some code for your requirement.check this once

In your data control place below code
<td onclick="f1(this,<%#Eval("compid") %>)">
                       <asp:label id="Lbluid" runat="server" text="<%#Eval("compid") %>" xmlns:asp="#unknown"></asp:label>
                   </td>



可以从设计端或数据绑定事件添加.

并且javascript标记包含以下代码



It can be add from design side or databound event.

And the javascript tag contains following code

function f1(tid, asr) {
      //alert("your selected company ID is :"+asr+"; Selected Cell value is :"+tid.innerText);


(' #basic-modal-content' ).modal();
('#basic-modal-content').modal();


这篇关于用于在gridview中编辑单个单元格的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆