Two Way Sorting In GridView Using Object Data Source?
Feb 2, 2011
I am using Object Data Source to bind data in the gridview. I haveset the property AllowSorting=true. While running the application, Icould sort the data only in ascending order. Is there any way toachieve two way sorting in gridview ie. both ascending and descendingon successive clicks ?.
View 1 Replies
Similar Messages:
Mar 30, 2010
I have the web page that meet the problem. There exists a gridview and filtering. When Select all by using function A, it is OK. when Filter by using function B, it cannot filter and return no rows. When Select all again, it is OK. I have tested that function B can return the corrected filtered rows. But when databind in the web page, it cannot show and no error?
<ContentTemplate>
<asp:GridView ID="gvwBOM" runat="server" DataKeyNames="ProductID"
AutoGenerateColumns="False" DataSourceID="objBOM" AllowPaging="True"
AllowSorting="True" BorderWidth="0px" CellPadding="3" CellSpacing="1" CssClass="grid-view"
OnRowCreated="gvwBOM_RowCreated"
OnRowCommand="gvwBOM_RowCommand"
OnDataBound="gvwBOM_DataBound" >
.........
<asp:ObjectDataSource ID="objBOM" runat="server"
SelectMethod="GetALTBOMs"
SelectCountMethod="GetALTBOMsCount"
EnablePaging="true"
SortParameterName="SortExpression"
TypeName="QI.BLL.WMS.ALTBOM" >
private void FillGridView(string filter)
{
if(filter == "0")
{
objDataSourceSelect="Afunction";
this.objBOM.SelectParameters.Clear();
}
else
{
objDataSourceSelect="Bfunction";
this.objBOM.SelectParameters.Clear();
this.objBOM.SelectParameters.Add("productSupplimentID", ddlTmp.SelectedValue);
}
this.objBOM.SelectMethod = objDataSourceSelect;
this.objBOM.SelectCountMethod = objDataSourceSelect + "Count";
this.gvwBOM.DataBind();
}
View 1 Replies
May 10, 2010
I've posted the same question in the Object Data Source forum. This is a link to it http://forums.asp.net/t/1554083.aspx. Maybe I should've posted here to begin with. There seemed to be some overlap so I wasn't sure which was the best on to post the question in.
I'm trying to get a better understanding of how I could've designed my app so that the Object Data Source could work with the properties of my business objects. Please read the other post to see how it's currently being done. Sorry for the link to the other page. I didn't want to post a bunch of duplicate information. I would love to get some suggestions for alternative ways of doing this.
View 1 Replies
Dec 13, 2010
i grid view contain the following coloum
id name DateofBirth DateofJoining
1 a 22-Aug-1980 10-jan-2000
1 a 22-may-1980 20-feb-2000
1 a 12-Feb-1980 15-mar-2000
1 a 3-Aug-1980 7-jan-2000
how to sort if we click DateofBirth or Dateofjoining and not sort any where if we click(Id,Name)
View 6 Replies
Jul 19, 2010
I want to sort my gridview binded to an object datasource fetching business objects. I have already implemented custom paging & now want to implement sorting. Just read this article but there is lot of concatenation going on there with the SQL Query.
[URL]
View 2 Replies
Jul 18, 2010
Moderators Note: THIS ISSUE IS BIG FOR ME AND EVEN IF POSSIBLE, GET THE REPLY FROM THE DESIGNER OF GRIDVIEW. I have been looking for him for long. I am really fed up with reviewing a good lot of web pages on how we can possibly customize the gridview to enable sorting and paging. So many sites have listed out a lot of information and so many guidances. But the problem is that one works out fine and the other is a burden. I really feel bad about being given the job of customizing this kind of a gridview which has no user friendly approach to it. Also, this control is rendered without the pager links inside the <tfoot> tag. I have tried the Pear Pager in php. It is that good and easy to use and compared to that, the gridview in asp.net is the worst ever control i have ever tried so far.
1. i can use the images to indicate the sorting direction
2. I can have the custom pager like
[code]
<<Previous 1 2 3 .. 7 Next >>.
[/code]
When i click the next when i am viewing the page at 3 , the pager links should change as
[code]
<<Previous 2 3 4 .. 7 Next >>
[/code]
Kindly look into this type of requirement and firstly tell me whether this is possible with the gridview control. I would like this request even to be escalated to the designers of the gridview control also, so that Microsoft comes out with a reply THAT WORKS and not the kind of stuff like surfing through a lot of links and pages and finally wasting a lot of days precious time and still breaking the head with this useless control. I have spent a lot of time in searching for a perfect way. Not writing a code that is non-standard. I am really serious b'cos I have spent weeks in customizing this control. If I dont get a solid reply atleast now, I am going to generate all the output by HTML content by custom coding.
View 7 Replies
Feb 2, 2011
below is my code using for simple gridview and i am only having problem with the sorting and paging is working as expected and i even define the ONSorting event but it still throws me an error: [Code]....
[Code]....
View 7 Replies
May 3, 2010
Traditionally with an Object Data Source, the wired up class will have its public properties available for binding (i.e. Gridview columns, etc.) which works well. But what if one of my wired up business objects has a property that is an object itself; can I drill down to a property on that object property and still use it?
So in additiona to the traditional:MyBusniessObject.OrderID...I want to use:MyBusniessObject.Customer.NameID
Your 1st response might be to just wire up the 'Customer' class, but I need properties both on 'MyBusinessObject'and 'Customer'. I do not think this can be done, as the ODS will not display properties on an object instance property. I have tried manually typing in the drilled down value as well, but that wasn't a success either.
View 4 Replies
Nov 22, 2010
I think I'm getting mad here...I thought this should be super simple, but I just can't figure out how to do that.This is what I'm trying to do:I want to create an rdlc report using the ReportViewer control in ASP.NET 4 (VS 2010), and, as its datasource, use a class with some properties.I tried everything I can think of, but I just can't figure this out. All the docs I found state that the object should appear in the DataSource pane of the website, but I can't make it appear there.I would like the fields of the class to appear in the report desiger so I can use them - but I can't do that either.Using the designer, I can only define new dataset - I don't want to use dataset, but business objects!So - how can I do that? Do I have to use some kind of DataSource control? How can I make the report designer know about the business object?
View 2 Replies
Aug 20, 2010
I am writting a website using .net in some of my pages I need to use datagrid for showing some datas and for binding my data to datagrid I use object datasource something like below :
//this is
public class userData
{
private long userid = 0;
private string username = null;[code]....
and then in my apsx file I put an objectdatasource and bind the select statement to the GetUsersAmount() and then bind obejctdatasource to my datagrid but I think the way I've chosen is not efficient I just want to hear about your way of doing such these things.
View 3 Replies
Jun 21, 2013
I set up a DAL layer in a dll. This had a couple poorly named methods such as GetData(), which is the default name offered up in the tableAdapter wizard. I also added a few other methods for various reasons, all with better names. I then built the dll and referenced it in an ASP project. On one page, I added an ObjectDataSource, and set it to that tableAdapter (which isn't what I wanted to do, but that's a different story). Under the Select tab, I see the GetData and the other methods. Under the Update tab I see a variety of Update methods. Under the Insert and Delete tabs....I see the same methods as I saw under the Update tab. The Insert and Delete methods that exist for the tableAdapter were not available.
I figured that I did something wrong, and I didn't like that GetData name, so I went back to the dll and changed some things around (I think I added an Insert and Delete method, but by now I can't remember, except to say that I wasn't all that surprised not to see those two methods the first time). I also changed the GetData name to something else, then rebuilt the dll.
Since that time, I have yet to be able to change what shows up in the Object Data Source configuration. The Select adamantly insists on the GetData method, which no longer exists under that name, while the other three tabs all show a variety of Update methods, but neither Insert nor Delete. I noticed that just adding a reference didn't have any impact until the ASP project was built, which moved the dll to the bin folder where it needs to be for the Object Data Source configuration wizard to see it. Therefore, I deleted the dll from the bin folder, then rebuilt. I've also removed the reference, deleted the dll from the bin folder, rebuilt, added the reference, rebuilt again to get the dll back into the bin folder, and anything else I can think of. It still seems to be retaining the original schema from the tableadapter without ever updating to the new name for the GetData. Since that hasn't updated, the rest doesn't surprise me.
View 25 Replies
Jun 22, 2010
I am developing on application in that i have taken one list box and getting data to it using an object source.up to this stage it is fine.I need to compare these value what i get into list box and need to represent data in to a report viewer ..how to get these values from objectsource.i m new to c# i placing the code.
[Code]....
View 1 Replies
Jan 7, 2010
I have an object data source that is being used by an rdlc report, and the object data source uses a filter that is built from session variables passed to the page.
The report displays correctly, with the filter applied; however, I want to mark each of the rows as "printed" in a bit field in the database table.
In the table adapter, I have the following Update command that is used by the object data source:
UPDATE dbo.WorkOrder
SET boolWorkOrderPrinted = 'True'
WHERE (WorkOrderID = @Original_WorkOrderID)
And in the Page Load event, I run:
ObjectDataSource1.Update();
However, no records are updated.
View 1 Replies
Jun 26, 2010
I have a gridview with all columns read only except one. I want to configure the update method for the object data source to update only one column. The code i have written works when i make all columns editable but fails when i try to make only one column editable.
View 1 Replies
Nov 16, 2010
I used bind all GridViews, DetailViews etc. on my page using an ObjectDataSource (unless it wasn't possible to do so). Recently, I've started binding all my contols programatically. I find this a lot cleaner and easier, though some may disagree. Binding with a ObjectDataSource obviously has it advantages and disadvantages, as does doing it programatically.Say I bind a GridView programatically (e.g. GridView1.DataSource = SomeList), when I change page on the GridView, I have to also code this. Each time the page changes I have to call GridView1.DataSource = SomeList again. Obviously with a ObjectDataSource I don't need to do this. I normally stick my SomeList object into the ViewState so when I change page I don't need to hit the database each and every time.
My question is: Is this how the ObjectDataSource works? Does it store it's data in the ViewState and not hit the database again unless you call the .Select method? I like to try and get the best performance out of my applications and hit the database as few times as possible but I don't really like the idea of storing a huge list in the ViewState. Is there a better way of doing this? Is caching per user a good idea (or possible)? Shall I just hit the database everytime instead of storing my huge list in the ViewState? Is it sometimes better to hit the database than to use ViewState?
View 1 Replies
Oct 8, 2010
I am playing about just now trying to teach myself a little bit about the entity framework. I have a Gridview data bound to a Entity Date Source using the Entity Framework. If I select certain items in that list I then wish to redirect another page and populate another gridview with just the items selected (but with more detail, different includes/navigation properties)
This is probably the most simple thing but I have spent 2 hours banging my head on the wall trying to get this to work. Essentially I have a continue button which when clicked should identify all the UIDs (a column in the gridview) of the rows and allow me to subset to just these rows and pass them to another page to be rebound to another datagrid
View 2 Replies
Jun 15, 2010
I have extended GridView in order to have consistent look & feel, paging and sorting. However, when the page is first time loaded, the select method is getting called twice. It works fine when i move between pages in pagination.
Note, i am using Asp.net 2.0.
View 2 Replies
Sep 27, 2010
i wanted to retrieve things from the data base and perform mathmatical operations on it then post it to the user, so i was told to use the bullited list and bind it to the object dataSource
how to perform such thing??
View 1 Replies
Sep 15, 2010
In ASP.NET Webforms have an ASP.NET GridView connected to a C# class via an object data source
I have an ID set up as a DataKeyName in the grid. How do I pass this to the C# class when I update the grid?
View 15 Replies
Sep 20, 2010
my query is SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.CO
FROM V_HIERARCHY1 a
my data is ,HR HR Rec Records Leave Leave Records HRL.0001 Policy and Process for leave record. 27.06.2010 30.06.2010 WIP Edlink
HR HR Rec Records Leave Leave Records HRL.0002 Quarterly Review 01.07.2010 04.07.2010 Planned Edlink
HR HR DB Database SAL Salary DDS.0001 Calculation of Monthly salary 08.08.2010 09.08.2010 WIP Edlink
HR HR Rec Records Ind Induction Records HRI.0001 Completion of dossiers. 08.07.2010 10.07.2010 WIP Edlink
HR HR DB Database Emp Employee HDE.0001 Offer letter 06.07.2010 09.07.2010 WIP Edlink
my outout is ,HR
REC
LEAVE
HR1
REC1
LEAVE1
View 1 Replies
Oct 12, 2010
I'm working on a site where we want to include a pie chart on a page. Right now I'm working on implementing that through Reporting Services (RDLC file) with an object data source.The SelectMethod of my object data source is a method that returns a list of business objects; lets say a List<Alpha> and Alpha has a sub object Beta with a Name property. In my report definition I have set the Category groups to be: =Fields!Beta.Value.Name this means that Alpha.Beta.Name are my pie slices. I got the following error:
An error has occurred during report processing. The Group expression for the rouping 'chart1_CategoryGroup1' contains an error: Object variable or With block variable not set.I was able to confirm this is because Beta is nullable and was able to fix the issue by updating the object Alpha to return a new Beta() if the Beta property is null. This solution is not ideal though because there are other places in my code where I need Beta to be null if it doesn't have a value yet.Is there a way to update the report definition to accept a null property as valid? Ideally I would like to specify the value as "Not Set" if Beta is null.
View 1 Replies
Jan 21, 2011
In ASP.NET Webforms have an ASP.NET GridView connected to a C# class via an object data source
I have an ID set up as a DataKeyName in the grid. How do I pass this to the C# class when I update the grid?
View 2 Replies
Mar 24, 2010
I was looking at the options in Intellisense for the properties used with a parameter for the Object Data Source. There is one that I don't understand how it would be used. explain, or recommend an article, about the DB Type is for and how it would be used?
View 2 Replies
Dec 29, 2010
I populate a DetailsView from an ObjectDataSource that is coded in a class - meaning that the ods Select, Update, Insert and Delete are class methods. The selected record is set to come from a GridView.SelectedValue.
My problem is that when the page loads the code crashes. I am pretty sure I know why: the DetailsView is pulling from a class object and instead of using the existing class object it instansiates a new one which is empty.
Here is the details view code:
[Code]....
Here is the odsDetailsView_1:
[Code]....
As you can see from the code the odsDetailsView gets it's information from a class object "Match". The detailsview is not controlled by any code behind.
View 2 Replies
May 2, 2010
i made a small n-tier webapplication, a DATA project with my business objects a DA project with my datacces logic and a GUI project woth my website. For the CRUD operations on my main tables I use a lot of listviews, that works fine but when data grows its slows down.I used already used optimal paging & shared collection's to preventing database acces if data is already loaded en that helps alot.But I see when a user select the EDIT command the select of my listview is performed what is not needed, also when the user than select cancel the select is again called , is this normal behavior or do I made a mistake in program logic somewhere because this behavior is slowing my application down.
View 1 Replies