Forms Data Controls :: How To Sort Grid On Two Column

May 12, 2010

In gridview I am able to sort on 1 column as mentioned below, I want to add one more column in sorting, what is the best way to do this,

[Code]....

View 2 Replies


Similar Messages:

Forms Data Controls :: How To Convert A Varchar Column To Int And Sort In Grid View

Jul 21, 2010

I have a grid view with manual sorting. In some cells, the data are numeric and datetime. But due to some constrains, the data type on tables are varchar. The problem here is when I sorting those numeric data, it is treated as varchar.Eg: 1, 12, 13, 2, 23, 3, ...But I wanted the order to be: 1, 2, 3, 12, 13, 23, ...I have tried these method, but it doesnt works.

[Code]...

View 9 Replies

Forms Data Controls :: How To Tell If The Event That Fired A Post Back Is The Gridview Column Click (to Sort The Grid)

Nov 17, 2010

If the grid column is clicked to sort i dont want to retireve data agian, i can get it from viewstate, but i dont know if that triggered the post back or if the ImageButton on the page triggered it

View 5 Replies

Forms Data Controls :: How To Change Sort Column Header Text And Retain The Sort Link

Jun 3, 2010

I have a simple dynamic gridview with following code -

GV = new GridView();

View 3 Replies

VS 2008 Grid View Sort Column Not Working

Aug 17, 2010

I have a GridView in ASP.Net 3.5. I added BoundFields as columns, set DataField and Header Text. Total I have 6 columns like that. Although I set "AllowSorting=True" in design view, when I run this page, all the columns didn't have hyper link that I can click on it and sort that particular column. I bind this column at code behind by using datatable.
gv.DataSource = dtDispatch
gv.DataBind()

View 1 Replies

C# - How To Sort The Grid View Whose Column Is Listing Integers

Feb 17, 2011

I am sorting the grid using DataView's "Sort" property. I am passing sort expression and the order in which the grid is to be sorted(ASC or DESC). But the problem is, since the column on which I am sorting the grid is listing the intergers, the sorting is happening as if it is a string. But I need integer sorting rather string sorting on that column.

The grid displays below as ascending order(string sorting)
55
77
8

But I need the columns to be displayed like this(Integer sorting)
8
55
77

View 2 Replies

Forms Data Controls :: Sort Grid View / What Is The Meaning Of Zero

Jan 10, 2011

I have this code that once a column in gridview is clicked, it sort the record. Can someon explain to me what does

static Int32 cntsortSecurityID = 0; // declare var to hold 0 or 1 // what is this, I dont understand why. what is the meaning of zero or One in this case . Oh yeas, the code is working for me, but I need to understand the concept behind it.

if (e.CommandName == "sortSecurityID")
{
DataView dv = ((DataSet)(Session["data"])).Tables[0].DefaultView;
if (cntsortSecurityID == 0)
{
dv.Sort = "SecurityID asc";
cntsortSecurityID = 1;
}
else
{
dv.Sort = "SecurityID desc";
cntsortSecurityID = 0;
}
gvTrans.DataSource = dv;
gvTrans.DataBind();
}

View 3 Replies

Forms Data Controls :: Show Grid With All Orders And In Grid One Column With Last State Of Order?

Feb 2, 2011

I have an entity "Order", which contains a set of states. Every state has date and name.

I want show grid with all orders and in grid one column with last state of order. But I dont understand how to do it.

View 1 Replies

Forms Data Controls :: How To Sort DataGrid Column

Oct 27, 2010

how to sort DataGrid column. (Say like FirstName) I have done snippet like: (see Bold text) For HTML :

<asp:DataGrid ID="dtgCustomerSearch" runat="server" AllowSorting="true">
<Columns>
<asp:BoundColumn HeaderText="CustomerID" DataField="CustomerID" />
<asp:BoundColumn HeaderText="First Name" DataField="FirstName"
SortExpression="FirstName" />
<asp:BoundColumn HeaderText="Last Name" DataField="LastName"
SortExpression="LastName" />
<asp:BoundColumn HeaderText="Phone No." DataField="Phone" />
<asp:BoundColumn HeaderText="Email ID" DataField="EmailID" />
</Columns>
</asp:DataGrid>

On Page_load I have wrote: this.dtgCustomerSearch.SortCommand += new DataGridSortCommandEventHandler(dtgCustomerSearch_SortCommand);

private void dtgCustomerSearch_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
SortExpression = e.SortExpression;
BindTheGrid();
}
string SortExpression
{
set
{
if (ViewState["SortExp"] == null || value != ViewState["SortExp"].ToString())
{
ViewState["SortExp"] = value;
}
else
{
ViewState["SortExp"] = value + " DESC";
}
}
get
{
return ViewState["SortExp"] == null ? string.Empty : ViewState["SortExp"].ToString();
}
}

View 5 Replies

Forms Data Controls :: Multiple Dropdown Filters To Sort A Grid View

Jan 4, 2010

wondering if someone can possibly help me out with a gridview. I have data coming into a grid and I know how to filter the data using one dropdown, I'm trying to get a little more advanced now. I'd like to filter using three dropdowns.

This is what I have so far: I don't know how to hook the downlists to the query?

<asp:DropDownList runat="server" id="DropDownList1" Width="90px">
<asp:ListItem Value="item_num">Item #</asp:ListItem>
<asp:ListItem Value="lot_num">Lot #</asp:ListItem>
<asp:ListItem Value="production_code">Production Code
</asp:ListItem>
<asp:ListItem Value="batchcode">Batch Code</asp:ListItem>
<asp:ListItem Value="inbound_no">Inbound #</asp:ListItem>
<asp:ListItem Value="recv_date">Received Date</asp:ListItem>
<asp:ListItem Value="location">Location</asp:ListItem>
<asp:ListItem Value="category">Category</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList runat="server" id="DropDownList2" Width="160px">
<asp:ListItem Value="=">is equal to</asp:ListItem>
<asp:ListItem Value="<=">is less than or equal to
</asp:ListItem>
<asp:ListItem Value=">=">is greater than or equal to
</asp:ListItem>
<asp:ListItem Value="<>">is not equal to</asp:ListItem>
<asp:ListItem Value="begins with">Begins With</asp:ListItem>
<asp:ListItem Value="Like">Ends With</asp:ListItem>
</asp:DropDownList>
<asp:TextBox runat="server" id="TextBox1" Width="150px">
</asp:TextBox>
<asp:Button runat="server" Text="Go" id="Button8" BackColor="Lime" />
<asp:Button runat="server" Text="Clear Filter" id="Button9" /><br />
<input name="Checkbox1" type="checkbox" /><label id="Label5">
Include Items containing "Zero on Hand" Quantity.<br />
Group by Fields: <input name="Checkbox2" type="checkbox" />
Item/Lot
<input name="Checkbox3" type="checkbox" /> Production Code
<input name="Checkbox4" type="checkbox" /> Batch Code</label><label id="Label4"></label><br />
<hr />
<asp:GridView runat="server" id="GridView1" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Font-Size="Small" BorderStyle="None" BackColor="White" GridLines="Vertical" BorderColor="#999999" BorderWidth="1px" CellPadding="3" Font-Underline="False"
AllowSorting="True" AllowPaging="True" PageSize="20">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:boundfield DataField="STATUS" HeaderText="Status" SortExpression="STATUS">
</asp:boundfield>
<asp:boundfield DataField="ITEM_NUM" HeaderText="Item #" SortExpression="ITEM_NUM">
</asp:boundfield>
<asp:boundfield DataField="LOT_NUM" HeaderText="Lot #" SortExpression="LOT_NUM">
</asp:boundfield>
<asp:boundfield DataField="LOT_EXT" HeaderText="Lot Ext" SortExpression="LOT_EXT">
</asp:boundfield>
<asp:boundfield DataField="RECV_DATE" HeaderText="Recv Dt" SortExpression="RECV_DATE">
</asp:boundfield>
<asp:boundfield DataField="PRODUCTION_CODE" HeaderText="Prod Code" SortExpression="PRODUCTION_CODE">
</asp:boundfield>
<asp:boundfield DataField="QTY_ONHAND" DataFormatString="{0:NO}" HeaderText="OnHand" SortExpression="QTY_ONHAND">
</asp:boundfield>
<asp:boundfield DataField="QTY_RESERV" HeaderText="Reserv" SortExpression="QTY_RESERV">
</asp:boundfield>
<asp:boundfield DataField="QTY_AVAIL" DataFormatString="{0:N}" HeaderText="Avail" SortExpression="QTY_AVAIL">
</asp:boundfield>
<asp:boundfield DataField="QTY_ADJUST" HeaderText="Adjust" SortExpression="QTY_ADJUST">
</asp:boundfield>
<asp:boundfield DataField="QTY_SHIP" HeaderText="Shipped" SortExpression="QTY_SHIP">
</asp:boundfield>
<asp:boundfield DataField="QTY_RECV" HeaderText="Recv" SortExpression="QTY_RECV">
</asp:boundfield>
<asp:boundfield DataField="PROD_DATE" HeaderText="Prod Date" SortExpression="PROD_DATE">
</asp:boundfield>
<asp:boundfield DataField="RELEASE_DATE" HeaderText="Release" SortExpression="RELEASE_DATE">
</asp:boundfield>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle HorizontalAlign="Center" BackColor="#999999" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" ForeColor="White" Font-Bold="True" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource runat="server" id="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:RemoteRooster %>" SelectCommand="SELECT * FROM [INVENTRY] WHERE OWNER = 'CompanyName' AND QTY_ONHAND > '0'">
</asp:SqlDataSource>

View 8 Replies

Forms Data Controls :: Multiple Column Sort In Listview?

Feb 25, 2010

Ive an page with listview.. i'm performing sorting in itemdatabound event like below:

[Code]....

and my listview looks like this:

[Code]....

I want to sort with multiple columns.

View 5 Replies

Forms Data Controls :: How To Sort A Gridview By A Calculated Column

May 25, 2010

Is there a way to Sort a Gridview by a Calculated Column? I have a gridview with template fields using lablels and a linq datasource. Those columns sort just fine. I can not get the Calculated column to sort, because there is no sort expression to use...

View 4 Replies

Forms Data Controls :: How To Sort A Gridview Column By Last 4 Digits

Jan 6, 2011

I have a gridview column named "Job Number" and the number is in this format: 01-04-11-3215, 01-04-11-3216 and so on...

Since the first few characters represent the date I need to sort on the last 4 digits.

View 2 Replies

Forms Data Controls :: Sort A Gridview By A Column That's Not Displayed

Mar 22, 2010

I have a datatable as a datasource to a grid view, it has a column amtDue, i would like to be able to sort by this column,, while not displaying it.

View 4 Replies

Forms Data Controls :: How To Write Grid View Template (All Option Sort,) In Code Behind

Sep 16, 2010

how to write grid view template (All option sort,) in code behind

View 1 Replies

Forms Data Controls :: Sort Functionality Not Working When Binding The Grid To A Collection Type Object?

Apr 1, 2011

My Grid is bound to a collection type datasource. When I try to sort the Columns in the Grid I get Javascript error saying sorting event not implemented. Why is the default inbuilt sort functionality not working which worked fine when I directly used a sqlDataSource using smart tag. Do I have to write some code to achieve sorting ?

View 1 Replies

Forms Data Controls :: Sort Gridview Column Without Going Back To First Page?

Mar 26, 2010

i have a gridview that has the ability to sort by each of the columns, but suppose if i'm on page 2 of the results and sort any of the columns, it jumps back to page 1. is there a way to keep it on page 2, still have the sorted date work?

View 3 Replies

Forms Data Controls :: GridView Sort Column Header Underline?

Feb 17, 2011

AllowSoting is true on every column of my gridvieww.

i want to remove those underlines in everycolumn ...

how can i do that?

View 3 Replies

Forms Data Controls :: Gridview Doesn't Sort On A Specific Column After Updating

May 10, 2010

I have been struggling with this problem for a long time. Does anyone have any clue about this problem? I created a gridview and set the allowsorting to true. This gridview has four columns: Name, Position, StartDate, and EndDate. I want the gridview to be sorted on the EndDate.

Inside of the save event, I called the BindGrid() function to rebind the datasource to the gridview. The changes will shown immediately, but the problem is that the records are not sorting on EndDate. I have to refresh the page manually to get the view sorted.

<asp:GridView ID="gvInfos" runat="server"
CheckBoxEnabled = "true"
ShowEmptyTable = "true"
AutoGenerateColumns = "False"
CssClass = "gv_white"
DataKeyNames = "Id"
GridLines = "None"
Width = "100%"
AllowSorting = "true"
>
<Columns>
<asp:ButtonField CommandName="Select" DataTextField="Name" HeaderText="Name" />
<asp:BoundField DataField="Position" HeaderText="Position" />
<asp:BoundField DataField="StartDate" HeaderText="Start Date"
DataFormatString="{0:Y}" />
<asp:TemplateField HeaderText="End Date" SortExpression="EndDate">
<ItemTemplate>
<%# (((DateTime)Eval("EndDate")).Year == (DateTime.MaxValue.Year) || (DateTime)Eval("EndDate") == null) ? "Present" : ((DateTime)Eval("EndDate")).ToString("y")%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

View 11 Replies

Forms Data Controls :: GridView Disappears When Click A Column Header To Sort?

Jul 28, 2010

I have a page with a TextBox, a Button, a GridView, and a SqlDataSource. I click the Button to execute the SQL in the TextBox using the SqlDataSource. The SqlDataSource populates the GridView. Everything works as expected until I click a column heading to sort.

When I click a column heading, the GridView disappears and I have to click the Button to display the grid again. When I do, the grid is displayed in the order of the column I clicked.

I don't understand why the GridView is disappearing when I click a column header.

Does anyone know how to fix this so the GridView is sorted and displayed only by clicking the column header?

ASPX:

[Code]....

Code behind:

[Code]....

View 9 Replies

Forms Data Controls :: Div Collapses Every Time Click On GridView's Sort Column Header?

Feb 8, 2010

I have several grid views indide div's, and when I click the Sort header on an open div the div collapses and no sort happens. I believe it is just reloading the entire page but when I surround PageLoad with !ISPostBack then the page redraws as blank. Since the sort script is generated by the GV, I don't know how to stop it from creating side effects.

Here's my code:

<script type="text/javascript" language="javascript">
function toggleDisplay(id) {
var obj = document.getElementById(id);
obj.style.display = (obj.style.display == "none") ? "" : "none";
return false; // cancel the href
}
</script>

[Code]....

View 6 Replies

Forms Data Controls :: Sort Static Text Of Hyperlink In Template Column Of Datagrid?

May 27, 2010

In Datagrid if we are using template column and we have hyperlink and this will have only view or edit whether we can sort it. If so how.

View 4 Replies

Forms Data Controls :: Have A Grid View With Some Coulmns Like Name,Phone No Etc With Edit,Delete Column In Grid View?

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

Forms Data Controls :: Binding Data In Column Of Data Grid To Other Column?

Jul 26, 2010

I have a boundcolumn that outputs string numbers. I have another column of checkboxes next to it. I need to have it so that when a user checks off a check box the value stored in the string column to the left is then plugged into a function on the server. How can I acheive this?Here is my code:

[Code]....

[Code]....

View 8 Replies

Data Controls :: Sort GridView Based On Column Name Specified In Selected Radio Button

Jan 4, 2013

i need to sort the gridview based on the radiobuttons. and i have 3 radiobuttons like dept,empcode,reporter..

if i click on any of radiobutton i need to show the gridview by sorting order..

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved