在服务端调用客户端脚本,将数据通过调用客户端脚本函数赋值给页面的文本框。有时候某个数据可能为空,则通过调用脚本函数赋值时文本框的内容为[ ],怎么样解决这个问题???
求救...
客户端脚本函数为 function rekey(num,name)
{
document.getElementById("txtNum").value=num;
document.getElementById("txtName").value=name ;}c#代码为 e.Row.Attributes.Add("onclick", "rekey('" + e.Row.Cells[0].Text + "','" + e.Row.Cells[1].Text + "');
求救...
客户端脚本函数为 function rekey(num,name)
{
document.getElementById("txtNum").value=num;
document.getElementById("txtName").value=name ;}c#代码为 e.Row.Attributes.Add("onclick", "rekey('" + e.Row.Cells[0].Text + "','" + e.Row.Cells[1].Text + "');
string str1="",str2="";
str1= e.Row.Cells[0].Text.Trim();
if(str1=="")
{
str1=" ";
}str2= e.Row.Cells[1].Text.Trim();
if(str2=="")
{
str2=" ";
}
e.Row.Attributes.Add("onclick", "rekey('" + str1 + "','" + str2+ "');
string a = e.Row.Cells[0].Text;
string b = e.Row.Cells[1].Text;
if(a=="")
{
a="[ ]";
}
if(b=="")
{
b="[ ]";
}
e.Row.Attributes.Add("onclick", "rekey('" + a + "','" + b + "');
function rekey(num,name)
{
if(num!="")
document.getElementById("txtNum").value=num;
if(name!="")
document.getElementById("txtName").value=name ;
}
�����ҵı����е������
������Ϊ��ʱ �Ҳ����ı�����ʾ   ������ʲô������ʾ������Ϊ�յ�����
就是当数据为空的时候 ,则调用方法时会显示  现在就是不让显示  ,怎么解决
{
if(num!=""&&num!= )
document.getElementById("txtNum").value=num;
if(name!=""name!= )
document.getElementById("txtName").value=name ;
}