目前我在同一行有两个表格单元格。
1st Cell's text:"如果您需要帮助......请联系"
2nd Cell的文字:帮助链接
所以它显示为:
"如果您需要帮助......请联系___________________ Help Link
我需要将其归结为仅一个单元格,以便我可以删除文本和帮助链接之间的空白区域。
我尝试添加一个单元格并连接如下:
cell1.Text = "If you need help...contact "+myPlaceHolder;
没有抛出错误但只显示了c#代码。
无论如何,这是我的代码:
TableCell cell2= new TableCell();
cell2.Width = Unit.Percentage(25);
TableCell cell1 = new TableCell();
cell1.Width = Unit.Percentage(75);
HyperLink myHyperLink= new HyperLink();
myHyperLink.Text = "Help Link";
myHyperLink.NavigateUrl = String.Format("javascript:void(window.open('" + myURL + "','_blank'));");
PlaceHolder myPlaceHolder= new PlaceHolder();
myPlaceHolder.Controls.Add(myHyperLink);
cell2.Controls.Add(myPlaceHolder);
cell1.Text = "If you need help...contact";
rowEmp_Relations.Cells.Add(cell1);
rowEmp_Relations.Cells.Add(cell2);
答案 0 :(得分:1)
不确定为什么在这里使用占位符。只需使用文字控件,它将正确显示标记(应该)。点击对此代码不起作用,但如果你调整它,我相信你可以搞清楚。它确实解决了关于一起显示文本的主要问题。
Request Method: GET
Request URL: http://192.168.1.230:8080/
Django Version: 1.5.5
Exception Type: ImportError
Exception Value:
No module named http_client
Exception Location: /home/XXXX/www/PROJECT/buildout/eggs/djangorestframework-3.2.4-py2.7.egg/rest_framework/response.py in <module>, line 11
Python Executable: /home/XXXX/www/PROJECT/buildout/bin/python
Python Version: 2.7.6
然后将文字控件添加到您的页面。我尝试在您的代码中执行onclick事件,但是href将更容易工作。