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


Similar Messages:

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 :: 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

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 :: 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 :: 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

SQL Server :: Sort Varchar Column With Number?

Dec 4, 2010

i have a column in my table of type varchar (50)

beek1
beek10
beek3
beek6
beek61
beek2

i want to sort in my sql querry like this

beek1
beek2
beek3
beek6
beek10
beek61

View 5 Replies

SQL Server :: Sort A Column Varchar (50) That Contains Number?

Dec 4, 2010

how to write Sql querry to sort a column of type varchar (50) that contains number

a1
a2
a3
a11
a21

instead of

a1
a11
a2
a21
a3

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

Forms Data Controls :: How To Hide A Column In A Grid View

Aug 19, 2010

i have a grid view myGridView. I populate this gridview in the page load event as:

myClass newObj = new myClass();
myGridView.datasource = newObj.getItems();
myGridView.databind();

Now I wanted to hide some of the columns of the grid view. How I can do that?

View 5 Replies

Forms Data Controls :: Hide Grid View Column If Empty?

Apr 29, 2010

I want to hide a grid view column if that column is empty. How do I do this? I dont have much exp. with grids.

View 23 Replies

Forms Data Controls :: How To Add A Column To An Existing Binded Grid View

Jun 24, 2010

I got this code which bind a datatable to a grid view. After the binding, i wanted to add additional column to the right of the grid, how can I do that? My codes below failed to do it.

[Code]....

The Header value of "ID1" is shown, but the cells only shows a '-' instead of 'New Column' sign.

View 4 Replies

Forms Data Controls :: Create A Hyperlink Column In Grid View?

Nov 8, 2010

How can i create a hyperlink to Grid view column, when i click this column it should open Word documentnt.Each Column row values does have seperate information.

View 3 Replies

Forms Data Controls :: Want To Show Datalist In Grid View View Column On Click Of Linkbutton Show?

Apr 20, 2010

I have gridview and want to show datalist in grid view view column on click of linkbutton show.

[Code]....

View 2 Replies

Forms Data Controls :: How To Display Grid View With Column Names When Row Count Is Zero

Apr 1, 2011

Display grid view with column names when row count is zero. I dont want to insert new row when row count is zero. How can I achieve this

View 2 Replies

Forms Data Controls :: Hide Column In A Dynamically Created Grid View?

Jul 23, 2010

I have a dynamically created grid view in the load even of my web page. I am setting its data source at run time like

gv.datasource = someObject.getItems();
gv.dataBind();

Now I wanted to hide, that is to make some of the columns visible false.

First how can I do that, Second should I write the code in the same page_load event or I should write the code some where else, cause when I add this line of code

gv.colums[0].visible=false;

an exception is produces "Argument out of range"

View 3 Replies

Forms Data Controls :: Hiding Temple Column In Grid View If Empty?

Dec 15, 2010

I have a grid view which is made up of bounded and template columns. I have a check box which i select to show all/ show non empty columns.

My issue is hidding the template columns. I have the following code:

[Code]....

My issue is with the piece of code

[Code]....

How do I find the ID of the label in grid view column for the template column?

View 2 Replies

Forms Data Controls :: Drag N Drop Function In Grid View By Column?

Mar 1, 2010

I am in the process doing drag n drop for gridview by column cell. For example: there is 5 cell in a column, user are able to drag the first cell and drop it as 3rd cell.I have find through the internet but has find no resource on it.

View 1 Replies

Forms Data Controls :: Substitute Data In A Grid View Column For An Image?

Jun 17, 2010

I have a GridView control in my aspx page with a column that represents logging levels. Instead of displaying the word, e.g"Info", "Debug", "Error", etc. I want to display an image from a file. It seems like I may be able to do this with a template but I have been unable to find any examples of exactly how I would do this.

If "Info" then display "images/info.gif
If "Error" then display "images/error.gif
etc.

Here is my code snippet

[Code]....

View 13 Replies

Forms Data Controls :: Set A Column In Grid View And How To Add Data From Textbox

Nov 23, 2010

I just started to new asp.net.

how set a column of gridview?

and how to add data from text box to gridview?

View 4 Replies

Forms Data Controls :: Want To Change Width Of Column Of Dynamically Generated Grid View?

Jan 4, 2011

i hav a dyanmically generated gridview with autogenerated columns = true.. i want to change the width of a column of a grid... i tried to do it in row databound event as...

e.Row.Cells[1].Width = Unit.Pixel(300);

but it doesnt work... and since d columns are genrated dynamically i cant set d width as grd.columns[0].width =...

View 3 Replies

Forms Data Controls :: Grouping The Data Rows Of The Grid View Under The Column Selected?

Sep 22, 2010

I have a grid view that needs to be shown group wise. The grouping of the data should be dynamic and that is based on the column that is selected.

In general it should list all the rows and based on the coloumn header selected, all the rows should group by that column and should be listed under it. That also needs the template column for the check box and while group by there should be a check all option available for each group.

Even having the collapse and expand option for each groups is required.

I currently use VS 2005 and later will use 2008 and 2010, but will use the aspx code and not xaml.

View 2 Replies







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