1.绑定数据到dropDownlist,去掉重复的项。
public void bindModels()
{}
B.数据绑定(反选)
//datalist
//foreach (DataListItem item in DL_Main.Items)
//{
// CheckBox cb = (CheckBox)item.FindControl("selected");
// if (cb.Checked == false)
// cb.Checked = true;
// else
// cb.Checked = false;
//}
//repeater
for (int i = 0; i < this.DL_Main.Items.Count; i++)
{
CheckBox cb = (CheckBox)DL_Main.Items[i].FindControl("selected");
if (cb.Checked == false)
cb.Checked = true;
else
cb.Checked = false;
}
//查询数组里是否包含指定的字符。
string[] fwlist = serverlist.Split('-');
bool k = fwlist.Contains<string>("72");
ItemDataBound事件
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
HyperLink jr = (HyperLink)e.Item.FindControl("jr_qianyue");//链接(查询reapter的服务器控件)
}
<%#Eval("Ischarge").ToString() == "0" || Eval("Ischarge").ToString() == ""? "免费" : "价格:<span style='color:red;'>" + Eval("price").ToString() + "元</span>"%>
<%#Eval("Model_name").ToString().Length >10? Eval("Model_name").ToString().Substring(0, 10) + "....." : Eval("Model_name").ToString()%>
<asp:HyperLink id=Hyperlink3 runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ID") %>' Visible="False">
System.Web.UI.HtmlControls.HtmlAnchor linkSend = ((System.Web.UI.HtmlControls.HtmlAnchor)e.Item.FindControl("linkSend"));(查找reapter绑定数据之间的html控件
string rptime =DateTime.Parse( ds_hf.Tables[0].Rows[0]["ReplayTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");(显示24小时制的时间)
C.编辑器加载需要的菜单
<script src="kindeditor-4.1.10/lang/zh_CN.js" type="text/javascript"></script>
<script src="kindeditor-4.1.10/kindeditor.js" type="text/javascript"></script>
<script src="kindeditor-4.1.10/plugins/code/prettify.js" type="text/javascript"></script>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
KindEditor.ready(function (K) {
editor = K.create('#contentqq', {
items: ["source", "|", "undo", "redo", "|", "preview", "print", "template", "code", "cut", "copy", "paste", "plainpaste", "wordpaste",
"|", "justifyleft", "justifycenter", "justifyright", "justifyfull", "insertorderedlist", "insertunorderedlist", "indent", "outdent", "subscript", "superscript", "clearhtml", "quickformat", "selectall", "|", "fullscreen", "/", "formatblock", "fontname", "fontsize", "|", "forecolor", "hilitecolor", "bold", "italic", "underline", "strikethrough", "lineheight", "removeformat", "|", "image", "flash", "media", "insertfile", "table", "hr", "emoticons", "baidumap", "pagebreak", "anchor", "link", "unlink", "|", "about"],
afterBlur: function () { this.sync(); }
});
});
</script>