C# - Easiest Way To Make Only One Column Sortable

Oct 12, 2010

I have a datagrid with sorting. I set enable sorting to true, but that makes every column sortable. Is there a simple way to make it so that only one column header can be clicked for sorting? I feel like there should be a simple and quick fix for this, but who knows. some code:

<asp:GridView ID="ProductsGrid" runat="server"
AutoGenerateColumns="False" Height="323px"
style="margin-top: 23px; margin-left: 0px;" BackColor="White" CellPadding="0"
Width="1210px" OnPageIndexChanging="gridView_PageIndexChanging"
onrowdatabound="ProductsGridView_RowDataBound" AllowPaging="True"
PageSize="25" AllowSorting="True" OnSorting="ProductsGrid_SortCommand">

I then have several columns. Is there something I can set in the code for the column to disable all others or only make one sortable?

View 1 Replies


Similar Messages:

MVC :: Sortable Table / User Click On The Column Header And Sort The Column They Want?

Mar 25, 2011

i have a table which showing the food data from my Model, including Name, Amount, Storage and Expiry Date. I wish to either:

1. Let user click on the column header and sort the column they want

2. Or default showing the food which almost expired on the top of the table

View 4 Replies

What Is The Easiest Way To Include A Tooltip In The GridView Column

Oct 6, 2010

What is the easiest way to include a tooltip in the gridView column?

For example in this column

<asp:BoundField DataField="short_comment" HeaderText="Comments" ReadOnly="True" SortExpression="short_comment"/>

I would like to have something like

<asp:BoundField DataField="short_comment" ToolTipDataField="longer_comment"/>

Obviously the ToolTipDataField does not exist, but what would be the easiest way to achieve that functionality?

View 2 Replies

Forms Data Controls :: How To Make A Gridview Header Fix And Sortable

Mar 25, 2011

how to make a gridview's header fixed and sortable. All the solutions I've seen do one or the other, but not both. If I put the header in a separate table, I don't know how to make it sort. None of the CSS options I've seen work either.

My gridview isn't anything special, but it is databound via a data accessor in c#.

Here's the grid:

[Code]....

And the code behind:

[Code]....

View 6 Replies

Forms Data Controls :: Sortable Aggregated (computed) Column In A Gridview?

Jan 11, 2010

I have stumbled into a problem in which Im having a hard time solving. I have a linq data setup(based on a mssql) where a Purchase Order contains a number Equipments - each equipment has a price. I have a gridview that shows the summed price of the equipments that are included in a Purchase Order. This sum is currently being calculated on RowDataBound through a "listOfEq.Sum(Eq => Eq.PurchaseOrderPrice);" expression which works without any problems. My problem is that I want to be able to sort the gridview based on this summed value, which I cannot do with a normal sortexpression. My next thought was to create a function in my database to calculate the sum instead and then use this is my data basis for the summed column. I have created a function like this:

[Code]....

I want to create a sortable column based on this data. My thought is something like this:

[Code]....

Displaying the correct information is not a problem, however creating the sorting is. Im not sure what to put in the SortExpression. Anybody got an idea of what to do? Perhaps I am forced to use a computed column for this however I dont know to create this column when its based on another table. If this is the case, any idea about how to do create a computed column thats based on data from another table?

View 2 Replies

Forms Data Controls :: Make A GridView Column Invisible If Every Cell In That Column Is Empty?

Mar 4, 2011

No sense in showing a competely blank column. how to make a GridView column invisible if every cell in that column is empty?

View 3 Replies

What's The Easiest Way To Convert A BMP To A PDF

Aug 25, 2010

What's the easiest way to convert a BMP file to a single page PDF using ASP.net? I'm going to generate the 8.5" x 11" BMP in Flash (which means I can manipulate it to make it as easy as possible), then use a POST to upload it to an ASP page, which will convert it to a PDF and redirect the user to the PDF. I don't want to add any margins or anything else, it will be laid out properly in the BMP for full-bleed.Would it be easier to convert it to PDF in Flash, then upload?

View 1 Replies

Easiest Way To Url Path Encode?

Feb 22, 2011

I want to reliably and easily Uri encode paths such as "/folder/foo%bar" to "/folder/foo%25bar".

I would have hoped that HttpUtility.UrlPathEncode would do the trick but this method only escapes spaces. I don't want to url HttpUlity.UrlEncode as this will encode "foo bar" to "foo+bar" - which ain't what I want.

View 1 Replies

AJAX :: Easiest Way To Get ID For Autocomplete Text Box?

Jan 11, 2011

I have one page with 3 FormViews + 3 Modal PopUp for them (AJAX toolkit). Works great but I have dependancy. If add a new record in one modal pop up it should be available in another one. I use autocomplete which does the work the problem and I have a hidden combo box where I get the ID for the insert.

Problem? The problem is that when I insert new record it doesn't update the asp combox box (not AJAX) so I cannot get the new id.

What would the easiest way to get ID without doing post backs. I want to avoid post back because the entry in text box might not be valid (partially typed) so I want to make sure it is typed in full so it I can get unique row = ID.

View 2 Replies

Easiest Way To Securely Transfer Data From One Web To The Next?

May 21, 2010

I have 2 web sites running on the same server. Web1 needs to transfer data to web2 (same web server, different webs), passing sensitive data from one to the next. The browser will be using https. Are cookies possible/advisable here? My initial thoughts where to encrypt the data and pass through the querystring, both sites using a shared key. Perhaps also pass an encrypted expiration date to prevent the url from being reused in history if it's on a shared computer. Figuring it's https and encrypted, initially it sounds ok. However, my gut tells me its unsecure. Another option is a session server but that seems a bit overkill for what I'm after.

What is the best way to securely transfer a single piece of data from 1 site to the next on the same web and do it relatively simply?

View 2 Replies

C# - Make First And Last Column Not Clickable?

Oct 19, 2010

I have a table being generated in an ASP.net web app. The table has 4 columns. Currently each cell of each row can be clicked to get more detailed info. However, I do not want the first and the last cell in each row to be clickable. How can I make it so that only the first second and third cell can be clicked?

Below is some of the code (from the .cs file):

if(e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.BackColor = TRADER_BACKCOLOR;
e.Row.Cells[0].Font.Bold = true;
e.Row.Attributes.Add("onmouseover", "style.backgroundColor = 'Silver'");
e.Row.Attributes.Add("onmouseout", "style.backgroundColor = '" + TRADER_HEX + "'");
e.Row.Attributes.Add("onclick", "RowClick(this, '" + e.Row.Cells[0].Text + "');");
From the .aspx file:
function RowClick(caller, id)
{
if(document.getElementById(id).style.display == "block")
{
if(last != "" && parent == id)
{
HideDetailed();
}
document.getElementById(id).style.display = "none";
}
else
{
document.getElementById(id).style.display = "block";
}
}

View 2 Replies

JQuery :: How To Get At The Data After Doing A .sortable Serialize

Feb 3, 2011

How do I get at the data after doing a .sortable serialize? Here is my code :

[Code]....

View 1 Replies

Centering A Sortable Row Header In The GridView?

Mar 15, 2011

I cannot seem to center the header text of a column in my GridView if it is sortable. The html output is much different for a sortable column (it seems to place a table inside of the td column).

Any thoughts on what can be done to get this centered?

I put the html ouput in a jsfiddle here ... [URL]

I have tried the following code on the grid view with no success. Bear in mind that the bound fields are server controls I designed but they do not affect the header text in any fashion:

<sc:DateBoundField DataField="LastLogin" SortExpression="LastLogin" HeaderText="Last Login"
HeaderStyle-Width="125px" ItemStyle-Width="125px" HeaderStyle-HorizontalAlign="Center" />
<sc:SCommandButtonField Command="Change" ItemStyle-Width="100px" HeaderStyle-Width="100px"
HeaderText="Change" HeaderStyle-HorizontalAlign="Center" Image="img.axd?ico16=edit" />

View 2 Replies

JQuery :: Sortable Recieve Events

Feb 10, 2011

I have li list with jQuery sortable attached to it. but the receive function is never executed. When I drag list item 10 to the 2nd position the way i expect this code to execute is to execute the receive function. but it never gets executed.
[Code...]

View 1 Replies

Make A Column Invisible In A Gridview?

Mar 23, 2010

How do I make a column invisible in a gridview? I tried to use this:

dataGridView.Columns(0).Visible = False

But its getting an error "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index". How can I do this?

View 2 Replies

Web Service Example With JQuery UI Sortable Serialize Method?

Dec 22, 2010

am building jQuery UI sortable to store order in the database using serialize and ASP.NET Web Service. I know how to do it in php, but I am not sure how to do it in ASP.NET... I tried googling with little success.

$('#mylist').sortable({
handle: ".handle",
axis: "y",

[code]...

View 2 Replies

JQuery :: Call Function From Sortable And OnDrop

Feb 3, 2011

I am using .sortable on a div that I have. What I want to know is, how do I call a function when the drop event occurs? Here is my code at the moment :

[Code]....

View 2 Replies

Web Forms :: What Is The Easiest Way With JavaScript To Change The Width And Height Of An Webpage?

Dec 22, 2010

I now that I can just define the width and height of a page with the div tag to allow for dragpanels to work, but it messes things up with some browsers when rendering, sometimes shrinking the actual content to allow for the complete page and width to be shown such as on the IPAD. I have tried the Javascript below, but it doesn't work, and whenever I try to resize a page manually, it puts my computer into never never land.

Anyone have a clean Javascript that will change the width and height dynamically as I am moving a dragpanel.

I can move the dragpanel, but it snaps back as soon as I let go so in essense it doesn't work.

[Code]....

View 1 Replies

SQL Reporting :: Want To Make Column In Rdlc As Hyperlink?

Apr 21, 2010

I am using rdlc in .net 2008

I am populating data in rdlc.

I want set a column as a hyperlink now.

Is it possible in rdlc.

View 1 Replies

DataSource Controls :: Get Around The 'has No Supported Translation To SQL' For A Sortable Field?

Sep 12, 2010

There's an issue I'm having in several areas of my ASP.NET site, but am using the following as an example. If I can get it solved, then I'm reasonably sure it has applications elsewhere.Let's say I have a gridview based on the aspnet_membership table. Its LINQ datasource is aspnet_membership, which exists in my datacontext.By itself, it works GREAT in the grid.However, showing UserId in and of itself doesn't have much meaning; I wanted to include UserName.So, in my Public Partial Class, I created a read-only property UserName:

[Code]....

This retrieves and displays the correct data, no problem there.However, I'm not able to sort on that new column. When I attempt to do so, I get the following error: The member 'aspnet_Membership.UserName' has no supported translation to SQL.A workaround is, of course, to use a Sql datasource. But as I'm learning more about LINQ and the partial classes, I want to learn how to do it the correct way.

View 1 Replies

Forms Data Controls :: Easiest Way To Build XML Based Menu With Submenu

Sep 2, 2010

I need to develop an easy and quickly to build menu structure based on xml. The menu needs to have a "Main" menu at top of the screen and a submenu at the left of the screen. Excactly like this: [URL] where i need to get started and wich control i should use?

View 1 Replies

Easiest Method To Build Where Clause From Checked Items In DataList Of PreviousPage

Jun 25, 2010

I have a selection list that is generated dynamically, it lists a number of checkboxes that are based on an end-user editable table, as such I have no idea what data, or how much, might be contained in this table and how many checkboxes or what they might contain, other than the primary keys of the table. The user will select the checks they wish to see, and then control is passed to another page via PostBackUrl. The second page has to figure out which records to show (build it's where clause) based on the checkboxes checked in the previous page.

So, my problem is several-fold. First, asp:CheckBoxes don't have values. This can be worked around by a number of methods. Right now, i'm using a placeholder and dynamically creating the checkboxes in the ItemDataBound event of the DataList. I set the ID to "CheckboxKey1Key2" (where Key1 and Key2 are the primary keys of the check items). Second, I have to walk through the controls of the PreviousPage to dig out all these values. That in itself is also a pain, but doable. Now, my thinking is to build the where clause of my Linq2Sql query based on the keys I got from decoding the checked checkbox names. This all seems like a lot of jumping through hoops for something that shouldn't be this difficult. Am I missing something? Does anyone have any better solutions?

View 1 Replies

Make A Column Width Size Fixed In Datagridview Asp?

Dec 29, 2010

i have this column in a datagridview on aspx page

<asp:TemplateField HeaderText="Observacion">
<ItemTemplate>
<asp:Label ID="lblOrderID" runat="server" Text='<%# Eval("Observacion") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="200px" Wrap="False" />
</asp:TemplateField>

I have set up the itemstyle with and wrap to false, but anyways the width columns grows the the data is too long. i just want to change the height of the column not the width. Here us the complete code of the datagridview

<asp:GridView ID="GridView1" runat="server" AutoGenerateDeleteButton="True" CellPadding="4" EnableModelValidation="True" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False">
<columns>
<asp:boundfield datafield="ID_OBSERVACION" visible="False" />
<asp:boundfield datafield="AUTOR" headertext="Autor" />
<asp:boundfield datafield="FECHA" headertext="Fecha" />
<asp:TemplateField HeaderText="Observacion">
<ItemTemplate>
<asp:Label ID="lblOrderID" runat="server" Text='<%# Eval("Observacion") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="200px" Wrap="False" />
</asp:TemplateField>
</columns>
<AlternatingRowStyle BackColor="White" ForeColor="#284775" Wrap="False" />
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" Wrap="False" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>

View 1 Replies

C# - Make A Specific Column Editable Upon Clicking Edit?

Jan 22, 2011

I have a gridview with "Edit Update Cancel" command field. When I click Edit, all the columns in the particular row becomes editable. I just need to have 2 specific columns editable. How is that made possible ? (Screen Shot Attached) [In the screen shot all 3 columns are editable, I just need the second and third to be editable]

View 2 Replies

.net - Dynamic Data - Make Friendly Column Names?

Jun 17, 2010

I've created a Dynamic Data project with an Entity Framework model. It works nicely. But, right now it shows all my database tables with the db column names - which aren't always the most friendly (e.g. address_line_1). How can I got about giving these more friendly column titles that will display to the end user?

View 2 Replies







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