一下代码是保存grid view checked 列中更改的值:其中样式CbStyle列中的值有的是在页面上,有的是绑定的,在取值时情况不同取值方式不同!!希望对大家有用
$(document).ready(function() {
$("#btn_savepofunc").bind("click",function(){
var jq_postcode =$("#tx_postid").attr("value");
var jq_postname =$("#tx_postname").attr("value");
if (jq_postcode == undefined || jq_postcode.lenght <1)
{
alert("职务代码不能为空!");
return;
}
if (jq_postname == undefined || jq_postname.lenght <1)
{
alert("职务名称不能为空!");
return;
}
//var jq_postid=window.location.href.split("=")[1];
var jq_postid =$("#hid_text").attr("value");
if (jq_postid =="-1")
{
alert("请先保存职务信息!");
return;
}
var post_runtype="12";
var jq_funcid=0;
var jq_taskworkid=0;
var jq_typelist =0;
var re_result=0;
var jq_arrone="";
var jq_arrtwo="";
$("#Gv_TaskList input[type=checkbox]").each(function() {
if (this.checked ==true) {
post_runtype="12";
jq_funcid=$(this).parents("tr").find(".hid:eq(0)").html();
jq_taskworkid =$(this).parents("tr").find(".hiditem:eq(0)").html();
jq_typelist =$(this).parents("tr").find(".CbStyle:eq(0)").html();
if (jq_typelist.indexOf("<SPAN",0) >=0)
{
jq_typelist =$(this).parents("tr").find(".CbStyle:eq(0) span").html();
}
jq_arrone =jq_typelist.split(" :")[0];
jq_arrtwo =jq_typelist.split(":")[1];
if (jq_arrone ==undefined)
{
jq_arrone="";
}
if (jq_arrtwo ==undefined)
{
jq_arrtwo="";
}
}
else
{
post_runtype="13";
jq_funcid=$(this).parents("tr").find(".hid:eq(0)").html();
jq_taskworkid =$(this).parents("tr").find(".hiditem:eq(0)").html();
jq_typelist =$(this).parents("tr").find(".CbStyle:eq(0)").html();
}
jqure_save.save_post(post_runtype,jq_funcid,jq_taskworkid,jq_postid,jq_arrtwo,jq_arrone,function(response) {
if (response.error != null) {
window.alert(response.error.Message);
}
else
{
var result = response.value;
if (result == "成功")
{
re_result=0;
}
else
{
re_result=-1;
}
}
});
});
if (re_result ==-1)
{
alert("保存时有错误!");
}
else
{
alert("修改成功!");
}
});
});