MVC :: Implementing HTML Grid In Vs 2010?
Jul 15, 2010I have a requirement of implementing GridView in ASP.NET MVC which has an ability to add, update and delete records.
It should also have paging and sorting implemented.
I have a requirement of implementing GridView in ASP.NET MVC which has an ability to add, update and delete records.
It should also have paging and sorting implemented.
I'm considering going at this myself because my requirements are particular and highly customized:
The grid is bound to a collection of complicated objects, each of which may contain child and grandchild objects. Depending on data and context, the template'd cells vary from TextBoxes to ComboBoxes to Calendars to a combination of controls.TextBox cells have Google-style auto-complete functionality. Also each TextBox cell can expand into a small TreeView pane that allows hierarchy-navigating selection of a value should auto-complete be insufficient.Values from other controls can be drag-and-dropped into cells.Columns are re-sizable and re-orderable. Clicking their headers sorts data.All of the above is AJAX / client-side / Web 2.0 of course.
Has anyone built anything similar from scratch? Or used an effective tool to accomplish this goal? How well would Telerik meet my specs? Is it right to have the hunch that something this specific is best done by taking a Microsoft GridView and extending it myself?
how to implementing sorting in grid view..... iam using allowsorting=true property.... bt it sorting will not perform on boundedfileds..then i implement Onsortingevent.. bt what is the code for that.... and code for changing sort direction..
View 3 RepliesI am implementing an multilingual web site using ASP.Net. The languages are English,French and Arabic. Please note that Arabic's direction is RTL. What is the best way to implement the multilingual support. I am planning to use the .Net localization feature but the website texts are stored in DB. For the controls ( form controls) , I can used resx file. Do I need to build two different pages ( one for LTR and another for RTL )? Or can I have one ASPx file for all the three languages?
I would like to hear some best practices in implementing these kind of web applications.
I am in need of a very simple grid which the user should be able to edit very quickly. The grid will display a list of food items (name and price) that make up a menu.
My usual approach here is just a GridView bound to a collection of the food items with an Edit button to the left of every row. When the Edit button is clicked I navigate to an Edit page where the user can edit that item and click OK to save it to the database and then go back to the grid page, where the grid is reloaded and shows the edited item.
This approach however is much to slow, the user should be able to edit the grid much more quickly, ideally without posting back (either fully, partially or via ajax).
What I'm thinking is really simple, but I don't have the necessary javascript skill to create this...:
A UserControl that simply creates a new row of TextBoxes for every food item (along with maybe a Delete button). The 'grid' is thus always in 'edit mode' (it always shows the textboxes in every row) and the user can type in any textbox to change the name or price. When this change is made, nothing happens server side, yet. When the user presses Save, I finally run a save method that just checks all rows and saves the new values to the database.
Since the grid is so simple (just Name and Price and the underlying data has a unique Id as well obviously) I think this should be possible, but I wouldn't know how to create this...
I did try, I had a UserControl 'MenuGrid' that was nothing but a PlaceHolder (and two labels for the 'Name' and 'Price' menu headers). It has a DataSource property that I set to a collection of food items in the menu, and then for each of those food items I add a MenuGridRow (another UserControl) to the Placeholder. This MenuGridRow contains two TextBoxes and the Delete button. It also contains a HiddenField control that gets the Id of the food item.
Loading works fine, I can get all the data in this 'grid', but I don't see any way to save it back. Once I changed the items and want to Save on the server, I don't see any way to access the MenuGridRows from the MenuGrid (let alone accessing the TextBoxes on that in turn). I think the problem is that it's all just rendered to html and during runtime there is no such thing as a MenuGrid or MenuGridRow anymore. So all I have is a couple of TextBoxes with seemingly random names and there's no way for me to determine which Textbox belongs to which HiddenField (which contains the Id).
Also, I don't see any way to handle the deleting of a row; I was thinking to just run some javascript that deletes the MenuGridRow from the MenuGrid, but again same problem, there's no such thing as a MenuGridRow at that point and I'd have to figure out which TextBoxes and HiddenField belong to that row and then delete them via javascript.
I tried looking for an editable ajax enabled grid as well, so I don't have to do it all by myself, but I didn't really find anything useful. Most of the grids I found don't even work properly, some work but are still very slow (there's still a postback, they just put the grid in an UpdatePanel but that doesn't make it any faster).
How do I make the entire grid read only programatically?
View 7 RepliesLooking to show a confirm message when an IMAGEFIELD in my grid is clicked...something like this:
btn1.Attributes.Add("onclick", "return confirm('Are you sure?')")
I Have Link in a column of Html.grid in asp.net mvc application ,by clicking on that link ajax modal dialog popup is achieved ..while clicking on the link i want to pass url of page ....
how can i do it
I have done listing by using html.grid in my mvc application, need to do sorting How can i do that
View 4 RepliesUsing the ASP.NET grid view. It displays 3 columns with 1 row for each, displaying an integer saved in the database. I would like to have a text input one for each column, so the user can add a new row of integers to the database. (The table only displays the last row updated, that part seems to be working OK)
Here is the code I have that displays data but without the input option I would like.
What is the way this is done in ASP.NET (3.5)? Are there more options in the control or do I need to manually bring in text input controls and give each one manual code to update the database?
while binding grid getting html tags : for "&" getting & and space nbsp;
Protected Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(1).Text = Regex.Replace(e.Row.Cells(1).Text, txtSearch.Text.Trim(), _
Function(match As Match) String.Format("<span style = 'background-color:#FFFF00'>{0}</span>", match.Value),
[Code].....
I am working in asp.net and in that i am using grid view and now i want to convert grid view data which is dynamic to the html table so i can send an email.
View 1 Replieshow to scroll bar for grid using html and jquery.
View 1 RepliesI have to display some HTML from our system and do by using
DivOutline.InnerHtml = outlinetext;
where outlinetext is a string of HTML
However the string contains code as below
"<!--[if !supportLists]-->"
which for some reason also gets displayed.
I think it could be because the actual string is
("<!--[
but even when I try
outlinetext.Replace("<", "<");
the text does not seem to get replaced
How to make the comments not display or why the string.replace function cannot pict out "<" when I can see it is definately in the string?
We are sending html-based emails out to customers. This is a stripped-down version of it:
Code:
<table border="1" cellspacing="0" cellpadding="4">
<!-- Get the items here -->
<tr bgcolor="ddddee">
<td align="left"><strong>1</strong></td>
[Code] ....
I have this code in an html file and I can view it in IE. There are eight columns, and currently one row that just has a value of One in column 1, Two in column 2, etc.
So a customer is currently receiving an email with these eight columns. He wants a ninth column called "Special Instructions". It can be free-form text and therefore rather lengthy. The customer wants to make all the text smaller to accomodate the new field. How would this be accomplished? How does it know what font to use now?
I've been asked to take over a project that's filled with a bunch of bugs. It's currently using MVC 1.0 and there's a view with Html Helper Data Grid that uses a DataGridHelper class. I'm not that familiar with all of MVC yet, and I was wondering if it is possible to have the sorting of the columns be a POST event rather than a GET.
Currently when a user clicks a column to sort, the controller for the view calls the GET action method. This I guess is all fine and good, but the problem is that this view has a search form (which is a model in it's own right) with some text boxes and some drop down lists. When the GET action method is called, I lose all of the information in the search criteria. So when ever someone searches for something, but then wants to sort the results, it requries the db for all records (because all of the search criteria is cleared).
I guess there could be two solutions:
1) Is there a way to access the items in the search form / model in the GET portion of the action method? I've tried using ViewData or adding a parameter for the search form model, but (and maybe I'm doing it wrong) both return null.
2) Is there a way to make the sorting event of a column call the POST portion of the action method? That way I'll have the search form / model information and be able to sort the search result content instead of query for all records.
Also, there is a stored procedure that currently can handel all of possible search parameters. So, no matter what sort column is selected, or search parameters are entered, it can properly setup the sql query.
Is there anyway i can place a HTML Editor inside the gridview´s edit template? I tried this on the top:
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor"
TagPrefix="cc1" %>
And my template field for the text (which was suppose to be with HTML):
[Code]....
I tried to place the HTML Editor inside the Gridview and it didnt work.
I just cant seem to view the HTML markup from a SQL Cell in a GridView.
When I set the AutoGenerateColumns=False it's easy because I can set the boundfield property in the DataGird ASP.Net markup. However, I can't seem to do anything with the gridview if the AutoGenerate is turned on.
Here is my vb code:
Code:
Dim sqlcmd As String = "Select [Bugs:], [QC#:] FROM " & """" & datasource & """" & Extra
Using con As New System.Data.SqlClient.SqlConnection(connexstring)
con.Open()
Dim da = New SqlDataAdapter(sqlcmd, con)
Dim ds = New DataSet()
[Code] ....
I have html markup in the both columns that I need to show up.
Here is my Gridview:
Code:
<asp:GridView ID="GridView1" runat="server"
EmptyDataText="There are no data records to display."
BackColor="White" BorderColor="#999999" BorderWidth="1px"
CellPadding="3" ForeColor="Black" GridLines="Vertical" BorderStyle="Solid"
Visible="False" AutoGenerateEditButton="True">
[code].....
how to allow the gridview cell to show html after the columns have been generated?
i have one grid and one button when i click on that button then it expand and showing another grid under the row of parent grid how to do that.
View 2 RepliesWhy does the gridview put everything in a table?! Is there a way to not have the gridview generate any html what-so-ever and just use what I have in the ItemTemplate?
View 1 RepliesYou'll have to excuse my ignorance, I'm coming at this from a front-end perspective, and don't really know how to deal with data views in ASP.NET.
Basically, I'm trying to change the layout of some repeated data from a straight table, to something more design-heavy. It's the same data, just re-organised slightly. The current ASP.NET code looks like this:
[Code]....
However, I want to replace all of this, such that each 'row' of data renders like this:
[Code]....
How is this done? Can I just edit the code above, or would I need to do something more advanced in terms of not using a data grid and using some other control instead? Is it something that can be done in just a .aspx file or would it need to be done in C# and compiled?
I get an HttpException (details below) after installing Visual Studio 2010 Pro RTM in an application developed using Visual Studio 2010 RC. The platform used was ASP.NET MVC2 RTW (already under VS10 RC).
I first uninstalled all RC software and even ASP.NET MVC 2, and then did a "clean" install of VS10 RTM. The ASP.NET MVC 2 version now installed on my dev machine is 2.0.50217.0.
Exception Message: Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.
InnerException Message: <FilePath>ViewsLanguageRenderLanguageNavigation.ascx(6): error BC30451: 'Model' is not declared. It may be inaccessible due to its protection level.
The error occurs on this "Html.RenderAction":
[Code]....
The "LanguageController" just calls into another service function as below:
[Code]....
Does anybody have an idea what is causing the problem?
Edit:
By the way, I might also share the actual view (partial view) that would show the languages to select from:
[Code]....
I have a website which created first by Visual Studio 2005, then I convert in to Visual Studio 2008 and currently using Visual Studio 2008. After Visual Studio 2010 Service Pack 1, HTML 5 and CSS 3 seem to be available. I want to convert my website to a VS 2010 website which uses HTML5.
How can this be done?
Is it possible to convert it to an ASP.NET Web Application while I'm porting it from VS2008 to Visual Studio 2010 ?
I know how to convert a website to web application in Visual Studio 2008 but I haven't used Visual Studio 2010 and have no idea about the differences.
Visual web developer 2010 express; made a simple web page ( tables and text; that went fine) added a data grid; easily seen in design view, but not there at all in debug.
View 2 RepliesI am having a little problem with AJAX htmleditor, it works fine when testing on localhost, but after deploying it on server it wont work properly.
I have 3 different txt source for the htmleditor, and sometimes the texteditor just gets blank and even the toolbar of the editr disappear and after that doesn't matter which source i select the editor stays blank unless i reload the page.
Code:
'======================================= LOAD xxxxxDATA =====================================
        'Open a file for reading
        FILENAME = Server.MapPath("~adminexxxxxxexxxxxTemp1.txt")
         'Get a StreamReader class that can be used to read the file
         objStreamReader = File.OpenText(FILENAME)
         'Now, read the entire file into a string
  Â
Code].....