如何在模态弹出窗口中隐藏基于显示锚标签的数据.. [英] How to hide display anchor tag based data in modal popup..

查看:86
本文介绍了如何在模态弹出窗口中隐藏基于显示锚标签的数据..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在gridview中的锚标记。我只需要显示那个有数据的列



数据





这是我的功能用于显示弹出窗口绑定要弹出的数据。





函数getData(obj){



var spl = obj.id.split('_');

var id = spl [1];



if(!isNullOrEmpty(id)){

$ .ajax({

url:DataFiles.aspx / Description,

类型:'POST',

contentType:'application / json; charset = utf-8',

数据类型:'json',

数据:{id:+ id +},



成功:功能(数据){

< br $>


$('#DesPop Up')。modal('show');

$('#listOfNotes')。html('');

var divContent ='';

divContent + ='

Here is my anchor tag which is in gridview. i need to display only that column which has data

Data


this is my function which is used to show pop up bind the data to pop up.


function getData(obj) {

var spl = obj.id.split('_');
var id = spl[1];

if (!isNullOrEmpty(id)) {
$.ajax({
url: "DataFiles.aspx/Description",
type: 'POST',
contentType: 'application/json;charset=utf-8',
datatype: 'json',
data: "{id:" + id + "}",

success: function (data) {


$('#DesPopUp').modal('show');
$('#listOfNotes').html('');
var divContent = '';
divContent += '

';

divContent + ='';

// divContent + ='' ;

divContent + ='';

divContent + ='';



var i = 0;

$ .each(data.d,function(key,val){



i ++;

divContent + ='';

// divContent + ='
';
divContent += '';
//divContent += '';
divContent += '';
divContent += '';

var i = 0;
$.each(data.d, function (key, val) {

i++;
divContent += '';
//divContent += '
1。

';

divContent + ='';

// divContent + ='';

divContent + ='';

divContent + ='';

divContent + ='';



});

divContent + = '

Date 时间 事件 描述
'+ i +' '+ val [Date] +' '+ val [Time] + ' '+ val [Event] +' '+ val [描述] +'

';
divContent += '';
//divContent += '';
divContent += '';
divContent += '';
divContent += '';

});
divContent += '

DateTimeEventDescription
' + i + ' ' + val["Date"] + ' ' + val["Time"] + ' ' + val["Event"] + ' ' + val["Description"] + '

';

$('#listOfNotes')。append(divContent);







},

错误:功能(数据){

//

}



});







}

}











函数isNullOrEmpty(str){

if(str!= null&& str!='')

返回false;

else

返回true;

}



我尝试过:



要求只显示有数据的列,如果没有,那么在网格中隐藏该列。我传递给锚标签的id是关键,如果该id在数据库中有数据

它将绑定到div,否则它将为空

现在如何显示网格列,其中有数据hidde那列没有...





[ WebMethod]

公共静态列表< diarynotes>说明(字符串ID)

{



使用(var conn = new SqlConnection(PageBase.ConString))

{

conn.Open();

SqlCommand cmd = new SqlCommand();

cmd.Connection = conn;

cmd.CommandText =SP_GetData;

cmd.CommandType = CommandType.StoredProcedure;



cmd.Parameters.AddWithValue( @Id,id);

var dt = new DataTable();

dt.Load(cmd.ExecuteReader());



列表< diarynotes> list = new List< diarynotes>();

try

{

foreach(dt.Rows中的DataRow行)

{

DataNote dn = new DataNote();

dn.DataNoteDate = row [DataNoteDate]。ToString();

// dn.DataNoteTime = row [DataNoteTime]。ToString();

dn.Event = row [Event]。ToString();

dn .Description = row [Description]。ToString();

list.Add(dn);

}

}

catch(例外)

{

throw;

}

返回列表;





}

}

请帮帮忙?

';
$('#listOfNotes').append(divContent);



},
error: function (data) {
//
}

});



}
}





function isNullOrEmpty(str) {
if (str != null && str != '')
return false;
else
return true;
}

What I have tried:

requirement is to show only that column which has data , if no then hide that column in the grid.the id which i am passing to anchor tag is the key, if that id has data
in the database it wil bind to div else it wil be empty
now how to show grid column which has data hidde that column which doesnt have..


[WebMethod]
public static List<diarynotes> Description(string id)
{

using (var conn = new SqlConnection(PageBase.ConString))
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SP_GetData";
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue("@Id", id);
var dt = new DataTable();
dt.Load(cmd.ExecuteReader());

List<diarynotes> list = new List<diarynotes>();
try
{
foreach (DataRow row in dt.Rows)
{
DataNote dn = new DataNote();
dn.DataNoteDate = row["DataNoteDate"].ToString();
// dn.DataNoteTime = row["DataNoteTime"].ToString();
dn.Event = row["Event"].ToString();
dn.Description = row["Description"].ToString();
list.Add(dn);
}
}
catch (Exception)
{
throw;
}
return list;


}
}
please help ??

推荐答案

.ajax({

url:DataFiles.aspx / Description,

类型:'POST',

contentType:'application / json; charset = utf-8',

datatype:'json',

data:{id:+ id +},



成功:功能(数据){




.ajax({
url: "DataFiles.aspx/Description",
type: 'POST',
contentType: 'application/json;charset=utf-8',
datatype: 'json',
data: "{id:" + id + "}",

success: function (data) {



('#DesPopUp')。modal('show');
('#DesPopUp').modal('show');


('#listOfNotes')。html('' );

var divContent ='';

divContent + ='
('#listOfNotes').html('');
var divContent = '';
divContent += '
';

divContent + ='';

// divContent + ='';

divContent + ='';

divContent + ='';



var i = 0;
';
divContent += '';
//divContent += '';
divContent += '';
divContent += '';

var i = 0;


这篇关于如何在模态弹出窗口中隐藏基于显示锚标签的数据..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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