list view problem with respect to my problem - c#

I have a listview in wpf and i am swapping two items index..
the swapping must be visible to the user.
i tried giving thread delay..
it didnt work
How to do that..

If I was going to do this I would delete the list view and lock it up where you can't use it again. Then code whatever your list view was outputting in C# using whatever you use to query your database(I think LINQ to SQL is the most robust solution right now) and then use a string builder to construct the html. This way you can assign a id to each div and append an incrementing number to the end of the id. Finally you could write your javascript and use the id's. Here is a link that shows how to build a gridview without using a gridview control.
See the first answer to the question in this link: How to show pop up menu from database in gridview on each gridview row items?

I am not sure whether it will work for your problem or not.
I think you need some kind of animation there. If it is web project, you can use jQuery animation to do that.

Related

Manage state in MVC4

I have a page with around 20+ controls. Within this page I have a partial View which I am using to create an editable grid. This grid has Add New Row/Remove Row buttons on click of which data entered in the textboxes in grid row gets added to the grid.
Whenever I click these 2 buttons, my page is getting refreshed due to which whatever data is being entered by the user in the 20+ controls of main page is lost.
I have tried hopelessly searching for solutions quite some time, but still trying my luck out here. Any ideas are appreciated.
Well I recommend you to use full jquery mechanisms to add or remove rows. You can easily add or remove HTML elements. All you have to care about is to maintain the numbering system. I suggest you to use a view model that contains a list of objects that you need to add or remove. At first render it normally by providing list of objects (from database or other source, if required). After this define your add and remove buttons to type button and play with jquery to add remove table rows or even divs. After adding or removing required element, reorganize your numbering. At submit you can use either full postback or ajax postback. If Any confusion, let me know.

Creating an item based on text in a cell of a DataGrid

In a LightSwitch application I have the following three tables:
These tables are part of a bigger, already existing database that cannot be modified for this application.
I also have the following grid on the details page of a Post:
What's shown is the 'Tag' property of PostTag, filtered for just one Post.
So far so good. However, because there can be a lot of different tags, I want to allow users to create a new tag by simply typing in a non-existing tag into the AutoCompleteBox and then, in some way, create a new tag with the entered value.
I have found this blog post by Beth Massi explaining how one could do something like this, but the solution is for just a single AutoCompleteBox. It looks absolutely terrible in a DataGrid, because the button will be shown in all rows and I have not managed to find a way to disable them conditionally (in a DataGrid).
Another acceptable solution would be this one using a message box and LostFocus, but it, too, does not seem to play nice with a DataGrid.
Is there a way to get what I want, or do I have to add some other way of easily creating new Tags?

Editing control inside Row Edit Template

Hello, I'm currently trying to load data into one of the RowEditTemplate's controls.
I have a regular ASP.NET DropDownList inside said template. This list should be loaded with data from a List, where MyObject has an Id and a Name.
I've been searching for quite some time now and I don't seem to be able to find a way to get this list from the code behind and load said data.
Any help is welcome, thank you
Ok, as expected coming from lady luck(?), a little while after asking this I found the answer.
In order to get a control from inside the RowEditingTemplate you first need to get access to the Template in question. So, to answer my own question, in order to get my list I did:
DropDownList ddlMyObjects = (DropDownList)WebDataGrid1.Behaviors.EditingCore.Behaviors.RowEditTemplate.TemplateContainer.FindControl("control_MyObject");

Opening gridview in new window, passing parameters between pages

I have the following scenario I would like to implement.
I have a number of drop downs that the client can select a range of criteria. From this, they will press a button, the query will be generated and low and behold, a gridview will be produced in a new window (or at least give that impression) bound by an object datasource. I would also like the user to be able to amend the search numerous times so they can generate a number of new windows/gridviews.
Now then..what would be the best approach for achieving this result?
My initial thinking was to create a querystring generated by the client criteria selections (in the drop down lists), a new page would then take the querystring and populate the gridview here. My concern with this approach is that the query string could be a whopper...are there any disadvantages to creating a ridiculously long query string?
Alternatively, are there any other methods or ideas people have used to produce a similar desired effect?
Any suggests taken on board and all advice warmly received.
There is nothing wrong with a long querystring; it is just not as clean or as easy to use as Jeroen's session-object solution. Save the session object value:
Session("ObjectName") = variablename
Retrieve it:
variablename = Session("ObjectName")
The only reason to use a querystring is if you don't want the session data hanging around, though I can't imagine why that would be an issue.
You could handle the button's Click event and store the variables you need in Session object.
In the newly opened window with your gridview you take those values and assign them to the proper parameters in your ObjectDataSource's Selecting event.

C# Web reportviewer create link to page with id

I have a reportviewer and i want a field to act as a hyperlink. The hyperlink must look like: page.aspx?id=1 But how do i achieve this?
I have entered in the properties window, navigation tab, radio "Jump to URL": page.aspx?id=sum(Field!field.value)
This doens't work :(
What do i have to do to get this work?
Thnx in advance
Martijn
PS: I also have EnableHyperlinks set to true;
Your expression under "Jump to URL" should be:
="page.aspx?id=" & sum(Fields!field.value)
Although I see 2 potential issues with that. First of all, if I remember correctly, the URL must be an absolute path (e.g. http://www.test.com/page.aspx). Secondly, I'm not sure why you're summing on a field. If you mean to only get the "current" value of some field, you don't need the aggregate function, but you have to be sure you are inside a control that repeats data for each row of a dataset, e.g. a detail row of a table.

Categories

Resources