预期的C#标识符 [英] C# identifier expected
本文介绍了预期的C#标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不确定为什么会发生这种情况,但是当我尝试将gridview文本包装在mailto标记中时,会出现Identifier预期错误.
not sure why this is happening but when I try to wrap my gridview text in a mailto tag I get the Identifier expected error.
if (GVStatus == "Team")
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Visible = false;
e.Row.Cells[5].Visible = false;
e.Row.Cells[9].Visible = false;
string emailAddy = e.Row.Cells.[8].Text;
string strEM = "<a href='mailto:"+ emailAddy +"</a>";
e.Row.Cells.[8].Text = strEM;
e.Row.Cells[10].Visible = false;
}
}
gridview是动态的
the gridview is all dynamic
推荐答案
您的错误在以下几行中:
Your errors are in those lines:
string emailAddy = e.Row.Cells.[8].Text;
e.Row.Cells.[8].Text = strEM;
删除多余的.
,它将起作用:
Remove extra .
and it will work:
string emailAddy = e.Row.Cells[8].Text;
e.Row.Cells[8].Text = strEM;
请注意,您还创建了错误的HTML,它应该是:
As a side note you're also creating incorrect HTML, it should be:
string strEM = "<a href='mailto:"+ emailAddy +"'></a>";
这篇关于预期的C#标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文