Rendering Telerik MVC Grid In A Razor View?
Dec 16, 2010
I have the following markup in a 'content' page. Without the Render call, nothing renders, and with the Render call, the grid renders as the first element in the whole page, not inside the 'content' section defined by my view:
@using Telerik.Web.Mvc.UI
@model Outdoor.Mvc.ViewModels.OutdoorSite.SiteList
@{
Html.Telerik().Grid(Model.ItemList).Name("Site Grid")
.Columns(columns =>
{
columns.Bound(o => o.SiteId);
columns.Bound(o => o.Name);
})
.Pageable()
.Sortable()
.Render();
}
View 1 Replies
Similar Messages:
Mar 9, 2011
I have an aspx web page that renders correctly. When converted to razor, it does not. Here is a simplified example (stripped of all extraneous stuff).
aspx:
<asp:Content ID="indexContent" ContentPlaceHolderID="ToolContent" runat="server">
<% string test = "<div><b>Tag Test</b></div>"; %>
<h2><%= test %></h2>
</asp:Content>
razor:
@section ToolContent {
@{ string test = "<div><b>Tag Test</b></div>"; }
<h2>@test</h2>
}
The aspx renders as expected. The razor just displays the content of "test" (<div><b>Tag Test</b></div>) in the header tag.
I assume that my understanding of razor is flawed. If someone could enlighten me and/or show me a solution/work around.
View 1 Replies
May 27, 2010
i have a grid view with some coulmns like Name,Phone no etc with Edit,Delete column in grid view. I click a row in grid view to Edit,it goes another page where i can edit all fields .Once i update i redirect the page to gridview. I want the grid view to remain in that particular page say 4 of the grid view
View 5 Replies
Aug 24, 2010
It happened to add an extra Gridveiw Header in row_databound event , It did worked fine on !Postback but disappered on Page.Postback . Quick google search guided me to move the event to Row_Created event and every thing is okay .
Can any expert post some pointers , differnces between grid row_created vs row_databount with some sample table data created dynamically behaviour of both the events in !Postback and page.Postback .
View 2 Replies
Feb 9, 2011
I am doing a online web application whereby user is able to enter in new template as well as search for template. The Add template is located outside the grid view and if user clicks on the button, it will load the grid view that is populated with data as there is a row of empty fields at the bottom. However when I click on the Add Template button, the grid view does not appear.
This is my business logic that I used it to search for records as well to click on the Add Template button to add in new records:
[Code]....
[Code]....
[Code]....
View 6 Replies
Jun 8, 2010
i have a grid view which displays only one value and i need to extract that value and display it in a textbox?
View 4 Replies
Nov 22, 2010
I have a telerik grid with a checkbox. I am using a client template. There is a .DataBinding Ajax call attached. When the grid initially comes up, instead of a checkbox, it has the id value as text.If I hit refresh, the ajax call gets executed and when it comes back the checkbox appears. Is there any way to force the ajax call to happen when the grid initially paints so that I have a checkbox and not text..
View 1 Replies
Mar 14, 2011
I have a grid view which displays some values. now i have to calculate row wise sum of those values for each row and then display against them.i tried this code but i am getting error as Input String Was not in Correct Format.
public void gv_RowCreated(Object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int total = Convert.ToInt32(e.Row.Cells[1].Text) + Convert.ToInt32(e.Row.Cells[2].Text) + Convert.ToInt32(e.Row.Cells[3].Text) + Convert.ToInt32(e.Row.Cells[4].Text) + Convert.ToInt32(e.Row.Cells[5].Text) + Convert.ToInt32(e.Row.Cells[6].Text) + Convert.ToInt32(e.Row.Cells[7].Text);
((Label)gv.FindControl("Label8")).Text = Convert.ToString(total);
}
}
View 2 Replies
Apr 4, 2011
I have looked all over for elegant solutions to this not so age-old question. How can I lock down form elements within an ASP.Net MVC View, without adding if...then logic all over the place? Ideally the BaseController, either from OnAuthorization, or OnResultExecultion, would check the rendering form elements and hide/not render them based on role and scope. Another approach I have considered is writing some sort of custom attributes, so as to stay consistent with how how we lock down ActionResults with [Authorize]. Is this even possible without passing a list of hidden objects to the view and putting if's all over? Other background info: We will have a database that will tell us at execution time (based on user role/scope) what elements will be hidden. We are using MVC3 with Razor Viewengine. We're utilizing a BaseController where any of the Controller methods can be overridden.
View 1 Replies
Dec 15, 2010
How can i pass asp.net mvc telerik grid data to controller using Ajax call.I need to save the telerik MVC grid data in database.
View 2 Replies
Oct 19, 2010
I am trying to use a partial view for a file upload in a Create View.
Here is my partial view, I removed the submit button, as the view it is rendered in, should activat the form post:
@model dynamic
View 1 Replies
Sep 3, 2010
Currently i am using Telerik grid which filters are applied to each column. I am binding the SQL result set to grid. If the result set is empty from the database while binding, I should disable the filter option in the grid.
How can i achive the same through ASPX or Code behind using C#. Does Telerik Grid have any property to disable the filtering option when thre are no records.
View 2 Replies
Nov 18, 2010
Currently i am using Telerik grid which filters are applied to each column. I am binding the SQL result set to grid. If the result set is empty from the database while binding, I should disable the filter option in the grid.
How can i achive the same through ASPX or Code behind using C#. Does Telerik Grid have any property to disable the filtering option when thre are no records.
View 1 Replies
Feb 16, 2011
I need to display an error message in the view when there's an error in rendering the partial view in that View.
How can i handle the exception while rendering partial view and display the error message in the view?
View 3 Replies
May 12, 2010
I've introduced the (awesome) grid control and got it working fine on my dev environment.I deployed my site to my local dev server and got the following error:
[Code]....
View 4 Replies
Oct 25, 2010
What im trying to do is have an edit button that instead of opening the line for editing, it forwards you to a page where you can edit. Is this possible? I tried something with the client template, but the grid render is ignoring it completely.
View 1 Replies
Dec 27, 2010
I am using telerik grid in mvc2 application. I have to perform Watin UI test for my application. For that i need to select a row from the telerik grid. I was not able to select id for the telerik grid as the telerik grid doesn't have any id. can u please help me to select the particular row from the grid. I have 6 columns in the grid. Based on the value of a row in the column(should iterate though the column) i need to select the id of that row and hit on the select button of that row.
View 1 Replies
Apr 20, 2010
Is it possible to add client side validation to the fields of the Telerik MVC Grid at runtime. I am having validation JSON strings stored in the DB which I need to use when inserting or updating content
View 1 Replies
Aug 1, 2010
is it possible ro insert grid inside a panelbar i try this but i have some errorsi define a grid in the inctructuion .content()
View 1 Replies
Mar 8, 2011
I have a Telerik grid. For each row there is a details table. The row is of type NominationTypeClass and the rows in the details table is of type Nomination. So what this means for each nomination type there is a list of nominations. The grid's code:
<telerik:RadGrid
AllowPaging="true"
AllowSorting="true"
AutoGenerateColumns="false"
GridLines="None"
ID="rgMyNominations".......
I have an action column that has a link that says Withdrawn. When clicked I have a JavaScript confirm box with a Yes or No option. If yes, then the nomination status is updated to withdrawn. Then I want the grid to be refreshed to show the updated status. I used the grid's update command to to show the show the JavaScript's command box. It updates, but is it the correct way to do it?
protected void rgMyNominations_UpdateCommand(object source, GridCommandEventArgs e)
{
try
{
StatusManager.InsertStatus( /* required parameters */ );
// Refresh grid
rgMyNominations.DataSource = GetNominationTypes();
rgMyNominations.DataBind();.....
...it says that NominationDate is not a property of NominationTypeClass. This is wrong, I don't know why it is taking the type for the row to be the type of the details table? NominationDate is a property of Nomination. It seems like it is overriding the datasources.
View 1 Replies
Jan 14, 2011
My grid has 5 data columns and 1 command column (update/delete)the column separator between command column and last data column is missing, making everything shift when entering inline edit mode.
this is the grid's view code:
<%=
Html.Telerik().Grid<ActivityPOCO>()
.Name("ActivityGrid")
.DataKeys(dataKeys =>
{
dataKeys.Add(e => e.ActivityID);
}
.ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image))........
View 1 Replies
Dec 21, 2010
Problem: How to display more columns in a Telerik grid than are displayed in the rendered grid?
eg I'd like to only display on the screen the Surname, but on dump to csv would like firstname too.
I've tried visible = false, and display = false on the GridBoundColumns, but then they don't come out on the csv.
<telerik:RadGrid ID="grdAuctions" runat="server" AllowAutomaticDeletes="True" AllowAutomaticUpdates="True"
AllowPaging="False" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="odsAuctionSales"
GridLines="None" EnableEmbeddedSkins="False" OnItemDataBound="grdAuctionSales_ItemDataBound">
<ExportSettings HideStructureColumns="true" />
[Code]....
View 2 Replies
Jun 15, 2010
i m using Telerik grid to present memos received by user below is the code
[Code]....
where i m binding third column (Subject) my intention is to make an ActionLink where subject is the display text and i want a dynamic ID coming from <#=MemoID#>. memo id is working fine and gives me a link with dynamic Memo IDs. the problem is with the subject i.e ("<#=Subject#>") is rendered as it is on the screen without mapping to the actual subject of the memo. i have also tried ("<%#=Subject%>") but to no gain.
View 12 Replies
May 17, 2010
I have a telerik grid bound to a Linq data object, however, I limit the fields returned:
<IQueryable>filter = data.Select(x => new {x.ID, x.Name, x.Age});
I would like to access these fields in the ItemCreated method of the grid:
protected void rgPeople_ItemCreated(object sender, GridItemEventArgs e)
{
Telerik.Web.UI.GridDataItem item = (GridDataItem)e.Item;
?????? Person = (???????)e.Item.DataItem;
}
What do I declare ?? as so that I can use:
String ID = Person.ID;
String Name = Person.Name; etc
View 2 Replies
May 25, 2010
I wanted to ask what is the best practice to manage width of the radGrid.
For my application most users are running 1280 x 1024 so I would be happy to set my overall grid width to 1100. However, depending on the form in use, I sometimes have horizantal scroll bars. To solve this, I have been playing with the width of the grid, and also I have played with setting the itemstyle-width for one or two columns. Sometimes I accidentally get it right, and sometimes it is not quite right.
What is the best way to manage this? Do I set the grid, and then all columns, or just the grid, or just the columns? I guess there is a best practice, so just wondering how you handle it,
View 2 Replies