Columns arrangement in DataGrid - How to arrange DataGrid width manually at client side..(like expandable data columns in datagrid)

Dear Friends,

Please give me a solution for below problem,

I have to bind a data table to a DataGrid, I will be not knowing no of columns and data until runtime, so I did not configured columns widh at design time.

Now my client is asking me like, he want a facility to alter the column width at runtime, I mean he want to change columns width in client (IE), like window application.

So, will you please tell me how to provide facility to change column width of a datagrid at client by user ?

Thank you,

Sreedhar Nasum.

 

 

0
forum
12/3/2007 5:07:35 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

5 Replies
1192 Views

Similar Articles

[PageSpeed] 16

Hi:

  DataGrid will render as <table>. Take a look at following code please:

  <html>
<head>
    <style type="text/css">
td{word-break:break-all}
    </style>
</head>
<body>
<script type="text/javascript">
function myfunction()
{
document.getElementById("DataGrid1").style.width=10;
}
</script>

<input type="submit" onclick="myfunction()" value="Click Me"/>
<table id="DataGrid1" border="1">
<tr>
  <td>100 sdf34es  waer 

sessssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

ssssssssssssssssssssssssssssssssssssssssssssssssssss</td>
<td>100 ssssssssssssssssssssssssssssssssssssssssssssssssss</td>
  <td>200 sdfsffsf sda</td>
  <td>3sdfsdf sdfssa</td>
</tr>
</table>

</body>
</html>

Regards


Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Allen
12/5/2007 5:57:52 AM

Hi,

Thanks a lot for you response, it worked fine.

Could you please help to get an idea to implement functionality like, user should be able to drag column end to expand width like windows application.

Regards,

Sreedhar Nasum.

0
forum
12/5/2007 6:46:37 AM

Hi:

  It's not an easy task as to web application. You may need to wrtie JavaScript (simply move a <div> with the mouse moving when draged, which represents the column, when dropped, add it to <table>) or AJAX is needed.

Here's the sample for drag & drop rows.

http://weblogs.asp.net/rajbk/archive/2007/06/13/the-gridview-row-drag-overlay-extender.aspx

As to columns:

http://zhouruifu.spaces.live.com/blog/cns!F158B86F88F8B26D!1889.entry

  If you're not familar with JavaScript I recommend you to get started from here:

http://www.w3schools.com/js/default.asp

Regards


Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Allen
12/5/2007 7:01:04 AM

Hi,
The issue is to change the width of the column through UI and not repositioning the columns.

 Can you please provide a solution for this.

Thanks in advance
Aravind
 

0
Aravindan
2/1/2008 9:27:45 AM

Hi,

By that time, I have used GridViewResizeExtender.dll, this I got from net, even they have provided source code (java script). Just search for this dll in net. .I have this dll, but I dont know how to share with you, as I cant upload dll here.

Regards,

~Nasum. 

 

0
forum
2/1/2008 2:25:50 PM
Reply:

Similar Artilces:

Datagrid in Table -- How to keep table column from automatically expanding to width of datagrid
Hi All -This is probably more of an HTML issue than anything, but since datagrids are involved I'm posting here in hopes that someone has come across something similar.I'm trying to achieve some Excel-like functionality for my editable datagrid. Essentially I'm trying to freeze the first column of my DataGrid. I tried the CSS solution (using a DIV tag and setting the first column's CSS), but couldn't figure out how to keep the rest of the columns from going 'behind' the first column when scrolling.So, I'm now trying a double-datagrid solution where I simply use the first grid to hold the fir...

how to arrange columns in a datagrid
Hello There!,  Could you please tell me how can i arrange columns in a datagrid!. Actually I have a datagrid and i am filling some of its column from the database. and i have html code like, <Columns>    <asp:TemplateColumn  HeaderText ="Actual Start Date"  >       <ItemTemplate>                <asp:TextBox ID="tb1" runat="server" Text=""></asp:TextBox>       &...

datagrid, datagrid, datagrid help
hello everyone, why is this datagrid so confusing and tough to get right...is it really confusing or am i not getting it right...need immediate assistance....i am currently working on developing an email application. and i want to display the mails in a datagrid. so i have an aspx page called mailbox.aspx. and a menu consisting of Inbox, Sent mail, Starred, Trash and Compose .... on page_load i am able to assign the values to a data grid by hardcoding them. and i want to use the same datagrid for displaying the mails sent by the user or the starred mails of the user. and this needs dyn...

Datagrid in a Datagrid
I would like to place a datagrid in another datagrid based off the results of the datagrid I dont know if this would be possible but i will give you a basic idea of what i would like I have in the main datagrid the description of a computer and the image and price, in the other datagrid (or someother way) that is in the first datagrid i would like to list upgrade options specific to that computer. I have the table that relates to the description and price table but i dont know how to use the main datagrid as the trigger for which upgrades go to which computer...

Datagrid in Datagrid
Hi, I'm trying to create a webpage that can handle datagrid in datagrid. I have an aspx file and a web user control file. When I click the edit button in the webpage, a new web user control will be added to the webpage. This is done through code-behind method. This new datagrid must be able to do edit, update and cancel. But, the webpage can't catch the events of the second datagrid. By the way, the web user control is working fine except in the "datagrid in datagrid". Any idea how to fix this? Please feel free to ask if you need more detail. Thank you....

Datagrid into Datagrid
There is a datagrid(DG_B) into a datagrid(DG_A) When i click on Edit Columnfrom DG_B I get an error Object not foundHow do i make a reference into protected void DG_B_EditCommand(object source, DataGridCommandEventArgs e) to this DG_B ? What I've tried(but still not working): DG_B = ((DataGrid)e.Item.Cells[10].Controls[0]);DG_B = (DataGrid)e.Item.FindControl("DG_B");Best regards,Ivan Andrade The "source" parameter passed into your event handler should conatin a reference to your DataGrid. Simply cast it to the DataGrid type.Thanks, EdMicrosoft MVP - ASP/ASP.NET...

problem with datagrid columns width :datagrid vertical scrollong instead of paging
hI My requirement is like this. datagrid will have vertical scroll bar instead of paging. so that i kept false for show header. and i declared tr and td accroding to column names. so this heading row is static. but my records in datagrid is dynamic. this is the problem. according to dynamic rows,my static row  column width should also  change. how to do. or is there any other option for making datagrid vertical row instead of hiding header and making static row declared above rows. thanks. Hi, You could use a panel control for the scrollbar:<asp:Panel ID="Panel1" ...

Datagrid Column Width Control
I have a datagrid that I populate from an SQL query. The datagrid then automatically sets up the columns. The only column that I have explicitly listed is a Button Column. Is it possible for me to make that column stays a certain width, and the others can change accordingly? Thanks. if you want explicit control over the width of each column, you prbly have to use template columns.***********************Dinakar NethiLife is short. Enjoy it.***********************...

copy Datagrid columns to a new datagrid
i have a datagrid with autogeneratecolumns = false; i want to copy all bound, template, and other thing to a new datagrid. whether after bind or before binding.   Hy ssumair2, Your information is insufficient regarding what u are looking for !  ssumair2 wrote: i have a datagrid with autogeneratecolumns = false; i want to copy all bound, template, and other thing to a new datagrid. What actually do u intend to do ? U have set AutoGenerateColumns to False and still u want to copy all bound, template, and other thing to a new datagrid ! Can u be a little more specific.&nb...

(CLIENT SIDE DATAGRID SEARCHING) Javascript code needed to scroll a scrollable datagrid to a specific row in datagrid?
I have a page that has a datagrid within a 'div' element, so that the datagrid is scrollable. Also, on the same page, I have a 'Search' button that searches the 'Invoice Number' column for an invoice number equal to the  value entered by the user in a textbox with id 'txtSearch'. Though I am able to find the invoice number and highlight its row using javascript, how can I make the scroll bar of div move vertically down to the position of the highlighted row of the datagrid using client side code?sun21170 Hello sun, i've never tried this, and don't know if there'...

Copy Data From One Datagrid Column To Another Column
Hi all, I am trying to copy data from one column in a datagrid to another column in the same datagrid. I am using buttons to do this, not the edit, update, cancel datagrid buttons. This is what I have been trying but with no luck :int RowCount;RowCount = 1;string DataValue;//while (RowCount < DataGrid1.Items.Count)//{// DataGrid1.SelectedIndex = RowCount;// DataGrid1.SelectedIndex = RowCount;// DataValue = DataGrid1.SelectedItem.Cells[4].Text;// DataGrid1.SelectedItem.Cells[3].Text = DataValue;} Help appreciated thanks. Try this <%@ Page Language="C#" %&...

hide datagrid columns client side
how to hide colums dynamicall (client side) not using serverside code....

How to place a DataGrid Control with in a DataGrid Control
Hi, I want to place a DataGrid control in a DataGrid control can any one plz tell me the procedure to place the control Thanks in Advance Krisamigo <!---<asp:DataGrid ID=dg_List runat=server><Columns><asp:TemplateColumn><ItemTemplate><asp:DataGrid ID=dg_List2 Runat=server></asp:DataGrid> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> ---> Hardik Joshi...

Column within a column in a DataGrid
Hi, I have a DataGrid on which I would like to divide a particular column into 2 to display a number information on the sub column?? Visually I'm speaking something like this below. +----------------+-----------------+ | ACCOUNTID | ACCOUNT NO | +----------------+-----------------+ | 1000 | | 125364 | | 1015 | | 125365 | | 1025 | | 125312 | +-----------------+----------------+ My question again is how to see this extra sub column within the ACCOUNTID Column here. Looking for a quick reply. Th...

Web resources about - Columns arrangement in DataGrid - How to arrange DataGrid width manually at client side..(like expandable data columns in datagrid) - asp.net.presentation-controls

Arrangement - Wikipedia, the free encyclopedia
This article is about arrangements in music. For geometric arrangements, see Arrangement of hyperplanes . For other uses, see The Arrangement ...

Arrangement - Wikipedia, the free encyclopedia
This article is about arrangements in music. For geometric arrangements, see Arrangement of hyperplanes . For other uses, see The Arrangement ...

Arrangement - Wikipedia, the free encyclopedia
This article is about arrangements in music. For geometric arrangements, see Arrangement of hyperplanes . For other uses, see The Arrangement ...

Strangest arrangement of statues ever: Pelé (the Brazilian football player), Mother Theresa and Dr. Ambedkar ...
... arrangement of statues ever: Pelé (the Brazilian football player), Mother Theresa ...

Seite 1 der Kommentare zu Apologize - OneRepublic Piano Arrangement (Available on iTunes) - YouTube
Zeige deine Videos deinen Freunden, Familienmitgliedern und der ganzen Welt.

Love and loss: Bunkie King's 'unusual arrangement' with Jack Thompson
When Bunkie&nbsp;King &ldquo;made out&rdquo; in a blue Datsun with her sister&rsquo;s boyfriend, Australian actor Jack Thompson, it was the start ...

Mr Fluffy: Government outlines security arrangements for vacated homes
Access to empty homes is restricted and the incentive for unauthorised entry is minimised, including through destruction of fixtures and any ...

Sugar babies: Seeking Arrangement offers controversial service
WHEN unemployed 23-year-old Eddie was offered a $1600 Louis Vuitton bag while out on his first date he couldn&#8217;t quite believe his eyes. ...

Employers fearful of work-from-home arrangements
Employees are increasingly wanting to work from home, but many employers are reluctant to grant such arrangements, fearing a decrease in productivity ...

Paul Foot review: Comedy Festival show at The Hi-Fi is a sweetly shambolic arrangement
Paul Foot's show is a must-see for comedy fans seeking hilarious nonsense.

Resources last updated: 12/25/2015 11:10:29 PM