本文整理汇总了C#中IHtmlWriter.WriteKnockoutDataBindEndComment方法的典型用法代码示例。如果您正苦于以下问题:C# IHtmlWriter.WriteKnockoutDataBindEndComment方法的具体用法?C# IHtmlWriter.WriteKnockoutDataBindEndComment怎么用?C# IHtmlWriter.WriteKnockoutDataBindEndComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHtmlWriter
的用法示例。
在下文中一共展示了IHtmlWriter.WriteKnockoutDataBindEndComment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderContents
protected override void RenderContents(IHtmlWriter writer, IDotvvmRequestContext context)
{
var properties =
GetDeclaredProperties()
.Where(p => !p.DeclaringType.IsAssignableFrom(typeof(DotvvmMarkupControl)))
.Select(GetPropertySerializationInfo)
.Where(p => p.IsSerializable)
.Select(p => JsonConvert.SerializeObject(p.Property.Name) + ": " + p.Js);
writer.WriteKnockoutDataBindComment("dotvvm_withControlProperties", "{ " + string.Join(", ", properties) + " }");
base.RenderContents(writer, context);
writer.WriteKnockoutDataBindEndComment();
}
示例2: RenderContents
protected override void RenderContents(IHtmlWriter writer, IDotvvmRequestContext context)
{
// render the header
head?.Render(writer, context);
// render body
if (!RenderOnServer)
{
writer.AddKnockoutForeachDataBind("dotvvm.evaluator.getDataSourceItems($gridViewDataSet)");
}
writer.RenderBeginTag("tbody");
// render contents
if (RenderOnServer)
{
// render on server
var index = 0;
foreach (var child in Children.Except(new[] { head, emptyDataContainer }))
{
child.Render(writer, context);
index++;
}
}
else
{
// render on client
if (InlineEditing)
{
var placeholder = new DataItemContainer { DataContext = null };
placeholder.SetValue(Internal.PathFragmentProperty, JavascriptCompilationHelper.AddIndexerToViewModel(GetPathFragmentExpression(), "$index"));
placeholder.SetValue(Internal.ClientIDFragmentProperty, "$index()");
writer.WriteKnockoutDataBindComment("if", "ko.unwrap(ko.unwrap($gridViewDataSet).EditRowId) !== ko.unwrap($data[ko.unwrap(ko.unwrap($gridViewDataSet).PrimaryKeyPropertyName)])");
CreateTemplates(context, placeholder);
Children.Add(placeholder);
placeholder.Render(writer, context);
writer.WriteKnockoutDataBindEndComment();
var placeholderEdit = new DataItemContainer { DataContext = null };
placeholderEdit.SetValue(Internal.PathFragmentProperty, JavascriptCompilationHelper.AddIndexerToViewModel(GetPathFragmentExpression(), "$index"));
placeholderEdit.SetValue(Internal.ClientIDFragmentProperty, "$index()");
writer.WriteKnockoutDataBindComment("if", "ko.unwrap(ko.unwrap($gridViewDataSet).EditRowId) === ko.unwrap($data[ko.unwrap(ko.unwrap($gridViewDataSet).PrimaryKeyPropertyName)])");
CreateTemplates(context, placeholderEdit, true);
Children.Add(placeholderEdit);
placeholderEdit.Render(writer, context);
writer.WriteKnockoutDataBindEndComment();
}
else
{
var placeholder = new DataItemContainer { DataContext = null };
placeholder.SetValue(Internal.PathFragmentProperty, JavascriptCompilationHelper.AddIndexerToViewModel(GetPathFragmentExpression(), "$index"));
placeholder.SetValue(Internal.ClientIDFragmentProperty, "$index()");
CreateRowWithCells(context, placeholder);
Children.Add(placeholder);
placeholder.Render(writer, context);
}
}
writer.RenderEndTag();
}
示例3: RenderEndTag
protected override void RenderEndTag(IHtmlWriter writer, IDotvvmRequestContext context)
{
if (RenderWrapperTag)
{
base.RenderEndTag(writer, context);
}
if (!RenderOnServer && !RenderWrapperTag)
{
writer.WriteKnockoutDataBindEndComment();
}
emptyDataContainer?.Render(writer, context);
}
示例4: RenderEndTag
protected override void RenderEndTag(IHtmlWriter writer, IDotvvmRequestContext context)
{
writer.RenderEndTag();
if (HasValueBinding(EnabledProperty)) writer.WriteKnockoutDataBindEndComment();
}
示例5: RenderContents
protected override void RenderContents(IHtmlWriter writer, IDotvvmRequestContext context)
{
writer.AddKnockoutDataBind("css", "{ 'disabled': IsFirstPage() }");
firstLi.Render(writer, context);
writer.AddKnockoutDataBind("css", "{ 'disabled': IsFirstPage() }");
previousLi.Render(writer, context);
// render template
writer.WriteKnockoutForeachComment("NearPageIndexes");
// render page number
numbersPlaceHolder.Children.Clear();
HtmlGenericControl li;
if (!RenderLinkForCurrentPage)
{
writer.AddKnockoutDataBind("visible", "$data == $parent.PageIndex()");
writer.AddKnockoutDataBind("css", "{'active': $data == $parent.PageIndex()}");
li = new HtmlGenericControl("li");
var literal = new Literal();
literal.DataContext = 0;
literal.SetBinding(Literal.TextProperty, new ValueBindingExpression(vm => ((int)vm[0] + 1).ToString(), "$data + 1"));
li.Children.Add(literal);
numbersPlaceHolder.Children.Add(li);
li.Render(writer, context);
writer.AddKnockoutDataBind("visible", "$data != $parent.PageIndex()");
}
writer.AddKnockoutDataBind("css", "{ 'active': $data == $parent.PageIndex()}");
li = new HtmlGenericControl("li");
li.SetValue(Internal.PathFragmentProperty, "NearPageIndexes[$index]");
var link = new LinkButton();
li.Children.Add(link);
link.SetBinding(ButtonBase.TextProperty, new ValueBindingExpression(vm => ((int)vm[0] + 1).ToString(), "$data + 1"));
link.SetBinding(ButtonBase.ClickProperty, GoToThisPageCommand);
object enabledValue = HasValueBinding(EnabledProperty) ? (object)new ValueBindingExpression(h => GetValueBinding(EnabledProperty).Evaluate(this, EnabledProperty), "$pagerEnabled") : Enabled;
if (!true.Equals(enabledValue)) link.SetValue(LinkButton.EnabledProperty, enabledValue);
numbersPlaceHolder.Children.Add(li);
li.Render(writer, context);
writer.WriteKnockoutDataBindEndComment();
writer.AddKnockoutDataBind("css", "{ 'disabled': IsLastPage() }");
nextLi.Render(writer, context);
writer.AddKnockoutDataBind("css", "{ 'disabled': IsLastPage() }");
lastLi.Render(writer, context);
}
示例6: RenderEndTag
protected override void RenderEndTag(IHtmlWriter writer, IDotvvmRequestContext context)
{
if (RenderWrapperTag)
{
base.RenderEndTag(writer, context);
}
else if (HasBinding(HtmlProperty))
{
writer.WriteKnockoutDataBindEndComment();
}
}
示例7: RenderContents
protected override void RenderContents(IHtmlWriter writer, RenderContext context)
{
writer.AddKnockoutDataBind("css", "{ 'disabled': IsFirstPage() }");
firstLi.Render(writer, context);
writer.AddKnockoutDataBind("css", "{ 'disabled': IsFirstPage() }");
previousLi.Render(writer, context);
// render template
writer.WriteKnockoutForeachComment("NearPageIndexes");
// render page number
numbersPlaceholder.Children.Clear();
HtmlGenericControl li;
if (!RenderLinkForCurrentPage)
{
writer.AddKnockoutDataBind("visible", "$data == $parent.PageIndex()");
li = new HtmlGenericControl("li");
var literal = new Literal();
literal.SetBinding(Literal.TextProperty, new ValueBindingExpression(vm => (int)vm[0] + 1, "$data + 1"));
li.Children.Add(literal);
numbersPlaceholder.Children.Add(li);
li.Render(writer, context);
writer.AddKnockoutDataBind("visible", "$data != $parent.PageIndex()");
}
writer.AddKnockoutDataBind("css", "{ 'active': $data == $parent.PageIndex()}");
li = new HtmlGenericControl("li");
li.SetValue(Internal.PathFragmentProperty, "NearPageIndexes[$index]");
var link = new LinkButton();
li.Children.Add(link);
link.SetBinding(ButtonBase.TextProperty, new ValueBindingExpression(vm => (int)vm[0] + 1, "$data + 1"));
link.SetBinding(ButtonBase.ClickProperty, GoToThisPageCommand);
numbersPlaceholder.Children.Add(li);
li.Render(writer, context);
writer.WriteKnockoutDataBindEndComment();
writer.AddKnockoutDataBind("css", "{ 'disabled': IsLastPage() }");
nextLi.Render(writer, context);
writer.AddKnockoutDataBind("css", "{ 'disabled': IsLastPage() }");
lastLi.Render(writer, context);
}
示例8: RenderEndTag
protected override void RenderEndTag(IHtmlWriter writer, IDotvvmRequestContext context)
{
if (RenderSpanElement)
{
base.RenderEndTag(writer, context);
}
else if (renderAsKnockoutBinding)
{
writer.WriteKnockoutDataBindEndComment();
}
}