【Asp.net笔记】占位符中去掉双引号的实现方法与意义
第一种占位符的用法最常见
html模板页中:
<input type="text" name="txtCategory_ID" value="$txtCategory_IDPH" />
对应ashx一般处理程序中:
fileContent = fileContent.Replace("$txtCategory_ID", category.Category_ID)
第二种用法:占位符不带引号,替换控件属性值
html模板页中: 有无子类:<input type="radio" name="rdBlechild" $rdBlechild />
对应ashx中
int i= Convert.ToInt32(category.BleChild); if (i == 1) { fileContent=fileContent.Replace("$rdBlechild", "checked='checked'"); } else { fileContent=fileContent.Replace("$rdBlechild", string.Empty); }

浙公网安备 33010602011771号