Model view controller .selective().HtmlAttributes(“style=font:bold”) .DataBinding(DataBinding=>DataBinding .Ajax().Select(“AjaxIndex”、“图例”)) .Pageable(pager=>pager.PageSize(10)) .Render(); %>
不清楚您的设置是什么。请发一些代码。我仍然没有得到任何答案。Atanas Korchev,你是不是Telerik MVC的家伙,通常在Telerik论坛上回答所有问题。我也在telerik论坛上发布了我的问题,但我还没有得到任何答案。如果有人点击“选择”链接,我想将“LegendName”设置为粗体,或者我想将该行的所有文本设置为粗体。忘记所选行操作。我只想在有人点击某个链接时将我的文本设置为粗体。我恐怕无法进一步帮助您。我仍然无法理解您的要求和面临的问题。Atanas Korchev您对我的问题的解决方案正在运行,但问题是我的网格的另一列中的文本在打开局部视图后不再保持粗体,它将恢复正常。除此之外,一旦我导航到最后一行(我有100行,我的网格是可分页的)并单击我的链接,我的局部视图将打开,但我的网格再次反弹,我丢失了突出显示的行。在这里,我开始面临新的问题。在这里,如果我再次点击任何链接,文本将突出显示,但我无法打开我的局部视图,突出显示的行将保留,因为它是“请帮助我的朋友”。您是关于Telerik MVC产品的唯一帮助来源。我已经更新了我的回复,以清除另一行中的CSS类。Model view controller .selective().HtmlAttributes(“style=font:bold”) .DataBinding(DataBinding=>DataBinding .Ajax().Select(“AjaxIndex”、“图例”)) .Pageable(pager=>pager.PageSize(10)) .Render(); %>,model-view-controller,grid,telerik,Model View Controller,Grid,Telerik,不清楚您的设置是什么。请发一些代码。我仍然没有得到任何答案。Atanas Korchev,你是不是Telerik MVC的家伙,通常在Telerik论坛上回答所有问题。我也在telerik论坛上发布了我的问题,但我还没有得到任何答案。如果有人点击“选择”链接,我想将“LegendName”设置为粗体,或者我想将该行的所有文本设置为粗体。忘记所选行操作。我只想在有人点击某个链接时将我的文本设置为粗体。我恐怕无法进一步帮助您。我仍然无法理解您的要求和面临的问题。Atanas Korchev您对我的问
<% Html.Telerik().Grid(Model.GetLegends)
.Name("PaymentScheduleLegendGrid")
.ToolBar(toolBar => toolBar.Template(() =>
{
%>
<label style="height:10px; float:left;padding-right:230px;" >Legend</label>
<%= Ajax.ActionLink("Add", "AddLegend", "PaymentSchedule", new AjaxOptions { OnSuccess = "updateTarget", UpdateTargetId = "addlegend", HttpMethod = "Get" }, new { Style="text-decoration:underline;" })%>
<%
})).HtmlAttributes("style='background:none grey'")
.DataKeys(dataKeys => dataKeys.Add(m => m.LegendId))
.Columns(columns =>
{
// columns.Bound(m => m.Legend_color).ClientTemplate("<div><div style='float:right;text-align:left;width:80%'><#= legend_name #></div>" + "<div style='padding:3px;background-color:<#= legend_color #>;width:20px;height:15px'></div></div>").Title("Legend");
columns.Bound(m => m.LegendColor).Format(Html.ColorBlock("{0}").ToHtmlString()).Encoded(false).Title("");
columns.Bound(m => m.LegendId).Hidden(true).HeaderHtmlAttributes(new { @class = "newBack" }); ;
columns.Bound(m => m.LegendName).Title("");
columns.Bound(m => m.LegendId).Title("").Format(Ajax.ActionLink("Select", "Select", "PaymentSchedule", new { Id = "{0}" }, new AjaxOptions { OnSuccess = "updateTarget", UpdateTargetId = "AddPaymentSchedule", HttpMethod = "Get" }, new { Style = "text-decoration:underline;" }).ToHtmlString().Replace("{", "{{").Replace("}", "}}")).Encoded(false).Width(60);
columns.Bound(m => m.LegendId).Title("").Format(Ajax.ActionLink("Edit", "EditLegend", "PaymentSchedule", new { Id = "{0}" }, new AjaxOptions { OnSuccess = "updateTarget", UpdateTargetId = "addlegend", HttpMethod = "Get" }, new { Style = "text-decoration:underline;" }).ToHtmlString().Replace("{", "{{").Replace("}", "}}")).Encoded(false).Width(60);
})
// .RowAction(row => row.Selected = row.HtmlAttributes.Add("style", "background:#321211;"))
.Sortable()
.Selectable().HtmlAttributes("style=font:bold")
.DataBinding(databinding => databinding
.Ajax().Select("AjaxIndex", "Legend"))
.Pageable(pager => pager.PageSize(5))
.Render();
%>
<%: Html.Telerik().Grid().ClientEvents(e => e.OnLoad("onLoad")) %>
<script>
function onLoad() {
$(this).delegate("tr a", "click", function(e){
$(this).closest("tr").addClass("t-state-selected") // add the css class
.siblings()
.removeClass("t-state-selected") // remove css class from other rows
});
}
</script>
So far I have done this .
<style type="text/css">
#PaymentScheduleLegendGrid table thead
{
}
.newBack
{
background:none grey;
}
.newBoldtext
{
font-weight:bold;
color:red;
}
</style>
<script type="text/javascript">
function onLoad() {
$(this).delegate("tr a", "click", function (e) {
$(this).closest("tr").addClass("newBoldtext"); // or any other CSS class
});
}
</script>
<div>
<% Html.Telerik().Grid(Model.GetLegends)
.Name("PaymentScheduleLegendGrid")
.ToolBar(toolBar => toolBar.Template(() =>
{
%>
<label style="height:10px; float:left;padding-right:230px;" >Legend</label>
<%= Ajax.ActionLink("Add", "AddLegend", "PaymentSchedule", new AjaxOptions { OnSuccess = "updateTarget", UpdateTargetId = "addlegend", HttpMethod = "Get" }, new { Style="text-decoration:underline;" })%>
<%
})).HtmlAttributes("style='background:none grey'")
.DataKeys(dataKeys => dataKeys.Add(m => m.LegendId))
.ClientEvents(e => e.OnLoad("onLoad"))
.Columns(columns =>
{
columns.Bound(m => m.LegendColor).Format(Html.ColorBlock("{0}").ToHtmlString()).Encoded(false).Title("");
columns.Bound(m => m.LegendId).Hidden(true).HeaderHtmlAttributes(new { @class = "newBack" }); ;
columns.Bound(m => m.LegendName).Title("test");
columns.Bound(m => m.LegendId).Title("")
.Format(Ajax.ActionLink("Select", "Select", "PaymentSchedule",
new { Id = "{0}"}
, new AjaxOptions { OnSuccess = "updateTarget", UpdateTargetId = "AddPaymentSchedule", HttpMethod = "Get" }
, new { name = "SelectRow", Style = "text-decoration:underline;" }
).ToHtmlString().Replace("{", "{{").Replace("}", "}}")).Encoded(false).Width(60);
columns.Bound(m => m.LegendId).Title("").Format(Ajax.ActionLink("Edit", "EditLegend", "PaymentSchedule", new { Id = "{0}" }, new AjaxOptions { OnSuccess = "updateTarget", UpdateTargetId = "addlegend", HttpMethod = "Get" }, new { Style = "text-decoration:underline;" }).ToHtmlString().Replace("{", "{{").Replace("}", "}}")).Encoded(false).Width(60);
})
.Sortable()
.Selectable().HtmlAttributes("style=font:bold")
.DataBinding(databinding => databinding
.Ajax().Select("AjaxIndex", "Legend"))
.Pageable(pager => pager.PageSize(10))
.Render();
%>