Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
885
Adding or Inserting new rows in server side?
posted

Hi,

In my project i have used UltraWebGrid to show the list of files that are present in a folder. I want to change it to WebDataGrid. I have the following questions

1) How to add a row to WebDataGrid in server side?

Previously, i get the list of files from a location and put it in a array , then depending upon the length of the array, i add new row to the UltraGrid. Below is the code

for (int i = 0; i < remoteval.Length; i++)

{

Infragistics.WebUI.UltraWebGrid.UltraGridRow drow ;

drow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow();

gridFiles.Rows.Add(drow);

drow.Cells[0].Text = imgFileLoc;

drow.Cells[1].Text = fileName;

drow.Cells[2].Text = filePath;

drow.Cells[3].Text = filesize;

gridFiles.Rows[i].Cells[0].Title = "Date Created: " + filecreated + '\n' + "Size: " + filesize;

gridFiles.Rows[i].Cells[1].Title = "Date Created: " + filecreated + '\n' + "Size: " + filesize;

}

I would like to do the same in WebDataGrid. One way of doing it is by adding the array into a DataTable and then bind the DataGrid to that datatable. This is a lengthy process and also i am not able to assign the tooltip for that row. Is there another way of doing it?

2) If there is a zip files in that folder and the user double click on the zip file, i will extract that zip and then show the Zip contents in the UltraGrid. Irrespective of the row position where the zip file is present, i will add the zip file contents to the next position starting from the zip file. The advantage of this is that user can download only the required files from the zip contents instead of downloading the zip file.

gridFiles.Rows.Insert(currentIDX + i + 1, new Infragistics.WebUI.UltraWebGrid.UltraGridRow(new object[] { "", FileName, FileLoc }));

How to achieve it using DataGrid. I have attached a zip file that contain 2 images that shows what happens before and after unzip of the files.

<igtbl:UltraWebGrid ID="gridFiles" runat="server" Width="325px" >

<Bands>

<igtbl:UltraGridBand>

<AddNewRow View="NotSet" Visible="NotSet">

</AddNewRow>

<Columns>

<igtbl:UltraGridColumn Key="Image" BaseColumnName="File" HTMLEncodeContent="false" Width="16px">

<Header>

<RowLayoutColumnInfo OriginX="1" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="1" />

</Footer>

</igtbl:UltraGridColumn>

<igtbl:UltraGridColumn Key="File" BaseColumnName="File" HTMLEncodeContent="True" Width="307px">

<Header>

<RowLayoutColumnInfo OriginX="1" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="1" />

</Footer>

</igtbl:UltraGridColumn>

<igtbl:UltraGridColumn Key="FilePath" BaseColumnName="FilePath" Hidden="True" HTMLEncodeContent="True" Width="0px" >

<Header>

<RowLayoutColumnInfo OriginX="2" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="2" />

</Footer>

<CellStyle><Padding Left="0px" /></CellStyle>

</igtbl:UltraGridColumn>

<igtbl:UltraGridColumn Key="FileSize" BaseColumnName="FileSize" Hidden="True" HTMLEncodeContent="True" Width="0px" >

<Header>

<RowLayoutColumnInfo OriginX="2" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="2" />

</Footer>

<CellStyle><Padding Left="0px" /></CellStyle>

</igtbl:UltraGridColumn>

</Columns>

</igtbl:UltraGridBand>

</Bands>

<DisplayLayout

Name="ctl00xgridFiles" RowHeightDefault="20px"

RowSelectorsDefault="No" SelectTypeRowDefault="Extended" ScrollBar="Never"

Version="4.00" CellClickActionDefault="RowSelect" AutoGenerateColumns="False" ColHeadersVisibleDefault="No"

AllowAddNewDefault="Yes">

<ClientSideEvents CellClickHandler="gridFiles_CellClickHandler" DblClickHandler="gridFiles_DblClickHandler" KeyDownHandler="gridFiles_KeyDownHandler" KeyUpHandler="gridFiles_KeyUpHandler" />

</DisplayLayout>

</igtbl:UltraWebGrid>

Thanks,

Raja

ZipExtract.zip
Parents
No Data
Reply
  • 12679
    Suggested Answer
    posted

    Hello Raja,

    Looking at your scenario

    cadcame said:
    I would like to do the same in WebDataGrid. One way of doing it is by adding the array into a DataTable and then bind the DataGrid to that datatable. This is a lengthy process and also i am not able to assign the tooltip for that row. Is there another way of doing it?

    in my opinion this is the way to implement it, simply because the grid does not support server-side row adding.

    About the tooltip you can see how to add it by following this thread: http://es.infragistics.com/community/forums/p/48340/256954.aspx

    if I understand correctly, concerning you second question, you may use  WebHierarchialDataGrid to represent the zip content. E.g. using the grid, in its parent band you can show the zip files and when user expand a row the content of the respective zip file could be loaded on demand.

    Check out various example and scenarios with this compenent:

    http://es.infragistics.com/products/aspnet/hierarchical-data-grid/

    Hope this helps

     

Children
No Data