473,837 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2853
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.GetFi les( )
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.GetFi les( Request.Physica lApplicationPat h )
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********@hot mail.com> wrote in message
news:O8******** *****@TK2MSFTNG P11.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.mach in AT dot.state.fl.us > wrote
in message news:%2******** ********@TK2MSF TNGP11.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.GetFi les( )
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.GetFi les( Request.Physica lApplicationPat h )
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********@hot mail.com> wrote in message
news:O8******** *****@TK2MSFTNG P11.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.EditIt emIndex = e.Item.ItemInde x and then call
DataGrid.DataBi nd() 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********@hot mail.com> wrote in message
news:u9******** ******@TK2MSFTN GP09.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.mach in AT dot.state.fl.us > wrote in message news:%2******** ********@TK2MSF TNGP11.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.GetFi les( )
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.GetFi les( Request.Physica lApplicationPat h )
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********@hot mail.com> wrote in message
news:O8******** *****@TK2MSFTNG P11.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.mach in AT dot.state.fl.us > wrote
in message news:uz******** ******@TK2MSFTN GP11.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.EditIt emIndex = e.Item.ItemInde x and then call
DataGrid.DataBi nd() 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********@hot mail.com> wrote in message
news:u9******** ******@TK2MSFTN GP09.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.mach in AT dot.state.fl.us >

wrote
in message news:%2******** ********@TK2MSF TNGP11.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.GetFi les( )
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.GetFi les( Request.Physica lApplicationPat h )
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********@hot mail.com> wrote in message
news:O8******** *****@TK2MSFTNG P11.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
2372
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 me how to do this. I know how to launch the 2nd form and how to make a public variable to hold the value but I can't figure out how to get the value. In Delphi what I need should be something like dataSet1.FieldByName('UserID').Value; Is...
3
1679
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" columns="1" Font-Size="8pt" text='<%# Container.dataitem ("LaborHoursAm")%>' >
2
1112
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
2060
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 table should be created or not. In order to do this, I need to have full control over the conditional logic for how items get displayed within a repeater element which I'm not seeing as possible. How can I cursor through a data set, apply...
9
12993
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 northwind database that has an employees, orders, and order details. the following are the 3 tables in my sql database students schyrsem
14
2137
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 grid and write to the database and I set the new Primary Keys and related Fields to the new asigned atuonumbers in the Access.
1
1915
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 TabControl - mainly a grid on one tab, and a checkboxlist on the other, that coordinate back and forth, so (un)checking a box will hide or show a column on the grid. In addition, I would like the flexibility of adding a DataSource at design time...
4
1927
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 create a new Excel spreadsheet and write data to it on the same computer, a computer that does not have Excel, or even Office installed. I have done some research on this and it appears it cannot be done. Can anyone verify that or better...
0
1171
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 from the dataset. So, once I load the dataset from the XML file, how would I load the grid with only the data from the dataset that had "smith" in the last name?
0
9686
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9416
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7007
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5675
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5855
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4479
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4053
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.