473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Creating or Getting a Dataset from a grid

I have a grid that shows the file list from a folder.
On the postback, how do I get a Dataset from this grid?
Thanks,
Filippo.
Nov 15 '05 #1
4 2819
Hi Filippo,

The grid is intended to work as a view of a data backend ( like a dataset )
it's not intended as a datasource , it's possible to take a grid and build a
data collection with it, basically a collection or records ( you can view
this as a array or a table), you could create a dataset with a table that
contain the same number of columns that cells has a grid's row.

Now this is extremely cumbersome and error prone, if what you have on the
grid is a listing of a folder's file then you should have previously bind
this grid with this data, using somethinig like Directory.GetFiles( )
If it's so then you could keep this array on session and in the postback
just get it back:

string[] FileArray;

if ( !IsPostBack )
{
FileArray = Directory.GetFiles( Request.PhysicalApplicationPath )
Session["FileArray"] = FileArray;

}
else
{
FileArray = string[] Session["FileArray"];
}
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:O8*************@TK2MSFTNGP11.phx.gbl...
I have a grid that shows the file list from a folder.
On the postback, how do I get a Dataset from this grid?
Thanks,
Filippo.

Nov 15 '05 #2
True,
but we also want to use the generic grid to upload XML files,
allow the user to make changes on the grid (Add, Edit, Del)
and then save back the grid values into the XML.

So, I was looking at creating my own XML with 2 for loops (Columns & Rows)

At that point I wonder if I could get a dataset off the grid and save it as
XML.
Filippo.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Filippo,

The grid is intended to work as a view of a data backend ( like a dataset ) it's not intended as a datasource , it's possible to take a grid and build a data collection with it, basically a collection or records ( you can view
this as a array or a table), you could create a dataset with a table that
contain the same number of columns that cells has a grid's row.

Now this is extremely cumbersome and error prone, if what you have on the
grid is a listing of a folder's file then you should have previously bind
this grid with this data, using somethinig like Directory.GetFiles( )
If it's so then you could keep this array on session and in the postback
just get it back:

string[] FileArray;

if ( !IsPostBack )
{
FileArray = Directory.GetFiles( Request.PhysicalApplicationPath )
Session["FileArray"] = FileArray;

}
else
{
FileArray = string[] Session["FileArray"];
}
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:O8*************@TK2MSFTNGP11.phx.gbl...
I have a grid that shows the file list from a folder.
On the postback, how do I get a Dataset from this grid?
Thanks,
Filippo.


Nov 15 '05 #3
Hi ,
The datasource of the grid is not important, the issue is that the grid is
mean only as a display of the data, that is kept somewhere else ( dataset,
xml, etc )

Maybe with one example this become clearer.
If the user edit one row, this generate a postback, in the postback you set
the DataGrid.EditItemIndex = e.Item.ItemIndex and then call
DataGrid.DataBind() to rebind the grid.

In the Update command of the grid you should get the edited values, update
the datasource and set the EditItemIndex = -1 and rebind the grid again, as
you can see you rebind the grid anytime that the datasource changed or how
that data is viewed is modified ( as put a row in edit mode ).

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl...
True,
but we also want to use the generic grid to upload XML files,
allow the user to make changes on the grid (Add, Edit, Del)
and then save back the grid values into the XML.

So, I was looking at creating my own XML with 2 for loops (Columns & Rows)

At that point I wonder if I could get a dataset off the grid and save it as XML.
Filippo.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Filippo,

The grid is intended to work as a view of a data backend ( like a dataset )
it's not intended as a datasource , it's possible to take a grid and build a
data collection with it, basically a collection or records ( you can

view this as a array or a table), you could create a dataset with a table that contain the same number of columns that cells has a grid's row.

Now this is extremely cumbersome and error prone, if what you have on the grid is a listing of a folder's file then you should have previously bind this grid with this data, using somethinig like Directory.GetFiles( )
If it's so then you could keep this array on session and in the postback just get it back:

string[] FileArray;

if ( !IsPostBack )
{
FileArray = Directory.GetFiles( Request.PhysicalApplicationPath )
Session["FileArray"] = FileArray;

}
else
{
FileArray = string[] Session["FileArray"];
}
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:O8*************@TK2MSFTNGP11.phx.gbl...
I have a grid that shows the file list from a folder.
On the postback, how do I get a Dataset from this grid?
Thanks,
Filippo.



Nov 15 '05 #4
Hummm I see.
OK let me give you a better idea of what I am doing.

I have a tree that shows 6 different XML names.
On click of a node I load the XML on a datagrid.

Then I let the user make changes (ADD-EDIT_DEL) and never post back until
the user clicks the SAVE button.

At that point, I get the MyDataGrid updated values and
....and save to XML.

I read somewhere that I could convert my grid back into a DataSet
and then (off course) save the DataSet as XML.

Even if I use the Edit-Add-Del events, I still don't understand how I can
update the datasource. What does the datasource, at that time looks like?

Is it a DataSet, or is it an XML in memory... ?

Hizzzzz !!!

<hehe>

Filippo.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uz**************@TK2MSFTNGP11.phx.gbl...
Hi ,
The datasource of the grid is not important, the issue is that the grid is mean only as a display of the data, that is kept somewhere else ( dataset,
xml, etc )

Maybe with one example this become clearer.
If the user edit one row, this generate a postback, in the postback you set the DataGrid.EditItemIndex = e.Item.ItemIndex and then call
DataGrid.DataBind() to rebind the grid.

In the Update command of the grid you should get the edited values, update
the datasource and set the EditItemIndex = -1 and rebind the grid again, as you can see you rebind the grid anytime that the datasource changed or how
that data is viewed is modified ( as put a row in edit mode ).

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl...
True,
but we also want to use the generic grid to upload XML files,
allow the user to make changes on the grid (Add, Edit, Del)
and then save back the grid values into the XML.

So, I was looking at creating my own XML with 2 for loops (Columns & Rows)

At that point I wonder if I could get a dataset off the grid and save it

as
XML.
Filippo.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>

wrote
in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Filippo,

The grid is intended to work as a view of a data backend ( like a

dataset )
it's not intended as a datasource , it's possible to take a grid and

build
a
data collection with it, basically a collection or records ( you can

view this as a array or a table), you could create a dataset with a table that contain the same number of columns that cells has a grid's row.

Now this is extremely cumbersome and error prone, if what you have on the grid is a listing of a folder's file then you should have previously bind this grid with this data, using somethinig like Directory.GetFiles( )
If it's so then you could keep this array on session and in the postback just get it back:

string[] FileArray;

if ( !IsPostBack )
{
FileArray = Directory.GetFiles( Request.PhysicalApplicationPath )
Session["FileArray"] = FileArray;

}
else
{
FileArray = string[] Session["FileArray"];
}
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:O8*************@TK2MSFTNGP11.phx.gbl...
> I have a grid that shows the file list from a folder.
> On the postback, how do I get a Dataset from this grid?
>
>
> Thanks,
> Filippo.
>
>



Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Red Green | last post by:
I have a form with a datagrid and a dataset bound to it. I want to launch a second form and pass it a value from whichever record the user has selected. I can't find an example anywhere that shows...
3
by: ALPO | last post by:
We have a datagrid built using template columns. Many are text boxes. These text boxes are bound to a datasource as follows: <ItemTemplate> <asp:TextBox id="txtPeriod1" runat="server"...
2
by: Filippo Pandiani | last post by:
I have a grid that shows the file list from a folder. On the postback, how do I get a Dataset from this grid? Thanks, Filippo.
3
by: Ben Becker | last post by:
I am trying to build a custom crosstab type of grid where I take some items in a data grid and based on the content of the current item compared to the previous item, determine if a new row in a...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
1
by: ben m | last post by:
Hi all - we've recently switched up to 2005, and I'm having trouble getting the hang of some things, among them, creating a control for the project. Currently, we use a combination of controls on a...
4
by: zacks | last post by:
I have an application that can read an Excel spreadsheet on a computer that doesn't have Excel installed on using the Jet ODBC 4.0 driver. I know need to modify the application to also be able to...
0
by: newsaboutgod | last post by:
I am loading a dataset from a XML file. I want to allow the user to display data from the dataset in a grid. Depending on which button they click i want to load the grid with a subset of data...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.