本文整理汇总了C#中UrlBuilder.ClearQueryString方法的典型用法代码示例。如果您正苦于以下问题:C# UrlBuilder.ClearQueryString方法的具体用法?C# UrlBuilder.ClearQueryString怎么用?C# UrlBuilder.ClearQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UrlBuilder
的用法示例。
在下文中一共展示了UrlBuilder.ClearQueryString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDisplayItemLink
protected override string GetDisplayItemLink(DataRow item, out bool showItemIndialog)
{
var web = SPContext.Current.Web;
var rawUrl = SPEncode.UrlEncode(Page.Request.RawUrl);
switch (List.BaseTemplate)
{
case SPListTemplateType.DiscussionBoard:
var discussionList = web.Lists[new Guid(item["ListId"].ToString())];
var discussionItem = discussionList.GetItemById(Convert.ToInt32(item["ID"]));
var rootFolder = SPEncode.UrlEncode(web.ServerRelativeUrl.TrimEnd('/') + "/" + discussionItem.Url);
showItemIndialog = false;
return string.Format("{0}/{1}/Flat.aspx?RootFolder={2}", web.Url, discussionList.RootFolder.Url, rootFolder);
default:
var type = item["Item Type"].ToString();
if (type == "1;#")
{
showItemIndialog = false;
var urlBuilder = new UrlBuilder(Page.Request.Url);
urlBuilder.ClearQueryString();
urlBuilder.AddQueryString("RootFolder", item["ServerUrl"].ToString());
return urlBuilder.ToString();
}
showItemIndialog = true;
return string.Format("{0}/_layouts/listform.aspx?PageType=4&ListId={1}&ID={2}&Source={3}",
web.Url, item["ListId"], item["ID"], rawUrl);
}
}
示例2: RenderFolderCreator
private void RenderFolderCreator(HtmlTextWriter writer)
{
var controlMode = SPContext.Current.FormContext.FormMode;
writer.AddAttribute(HtmlTextWriterAttribute.Id, "part1");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formtable");
writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
writer.AddStyleAttribute(HtmlTextWriterStyle.MarginTop, "8px");
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
// Td
writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formlabel");
writer.AddAttribute(HtmlTextWriterAttribute.Width, "190px");
writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-standardheader");
writer.RenderBeginTag(HtmlTextWriterTag.H3);
writer.Write("Name");
if (controlMode != SPControlMode.Display)
{
writer.AddAttribute(HtmlTextWriterAttribute.Title, "This is a required field.");
writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formvalidation");
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.Write(" *");
writer.RenderEndTag(); // span
}
writer.RenderEndTag(); // h3
writer.RenderEndTag(); // td
// Td
writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formbody");
writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
SPListItem folder = null;
if (controlMode != SPControlMode.New)
{
folder = SPContext.Current.List.GetItemById(Convert.ToInt32(Page.Request.QueryString["ID"], CultureInfo.InvariantCulture));
}
if (controlMode == SPControlMode.Display)
{
var viewUrl = Page.Request.QueryString["Source"];
if (string.IsNullOrEmpty(viewUrl))
{
viewUrl = SPContext.Current.List.DefaultViewUrl;
}
var urlBuilder = new UrlBuilder(viewUrl);
urlBuilder.ClearQueryString();
urlBuilder.AddQueryString("RootFolder", folder.Folder.ServerRelativeUrl);
writer.AddAttribute(HtmlTextWriterAttribute.Rel, "sp_DialogLinkNavigate");
writer.AddAttribute(HtmlTextWriterAttribute.Href, urlBuilder.ToString());
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.Write(SPEncode.HtmlEncode(folder.Name));
writer.RenderEndTag(); // a
}
else
{
writer.RenderBeginTag(HtmlTextWriterTag.Span);
if (!Page.IsPostBack && SPContext.Current.FormContext.FormMode == SPControlMode.Edit)
{
writer.AddAttribute(HtmlTextWriterAttribute.Value, folder.Name);
}
else
{
writer.AddAttribute(HtmlTextWriterAttribute.Value, folderName);
}
writer.AddAttribute(HtmlTextWriterAttribute.Title, "Name");
writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-long");
writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID + "$onetidIOFile");
writer.RenderBeginTag(HtmlTextWriterTag.Input);
if (!IsValid)
{
writer.Write("<br/>");
writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-formvalidation");
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.AddAttribute("role", "alert");
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.Write(ErrorMessage);
writer.RenderEndTag(); // span
writer.RenderEndTag(); // span
}
//.........这里部分代码省略.........