如何在会话变量的jquery网格的行中存储值? [英] how to store a value in a row of jquery grid in a session variable?

查看:103
本文介绍了如何在会话变量的jquery网格的行中存储值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jquery网格,其中包含与每一行关联的复选框.在选中复选框时,我需要将相应行的值存储在会话变量中.如何实现?

I have a jquery grid that contains checkbox associated with each row. on selecting checkbox I need to store the values of the corresponding row in a session variable.How can this be implemented?

推荐答案



我为您编写了一些代码,只需检查一下

放在数据控件中复选框的下方

Hi,

I write some code for your requirement just check this once

place below checkbox in your data control

<asp:CheckBox ID="CheckBox1" runat="server" onclick ="f1(this)" /



并将下面的javascript函数以及对jquery1.5.min的引用添加到您的脚本标签中



And add below javascript function to your script tag along with refference of jquery1.5.min

function f1(tid) {
        var str = new String();
        str = tid.id;
        var f = str.split('_');

       // alert("your selected row in data control is " + f[2]);


.post(" , {selectedindex:f2 [ 2 ]},函数(数据){}); }
.post("pagename.aspx?action=store", {selectedindex:f2[2]}, function (data) { }); }



在上面的代码中,您必须更改页面名称

并且在文件后面的代码中包含以下代码



in the above code you''ve to change pagename

And in code behind file contains following code

 //under page load
  if(!ispostback)
{
   if(Request.Querystring["action"]!=null)
    {
       string sid=Request.Form["selectedindex"].toString();
       //store id in session variable whenever you want just use that id
       //by using that id retrieve data from database to use
     }
}
</pre>
I hope I'm correct in your question

All the Best


这篇关于如何在会话变量的jquery网格的行中存储值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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