473,387 Members | 1,374 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,387 software developers and data experts.

How to use one datagrid to update/insert into another

I don't care how one suggests I do it, but I've been searching for days
on how to implement this concept. I'm trying to use some kind of grid
control (doesn't have to be a grid control, whatever works best) to
display a dropdown menu of fields populated from table tblInvoiceData.
This control also includes a textbox which the user can input a value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular field and
value displays in a grid (can be this original grid or another), BUT,
does not update the database tables until the user finshes adding all
their fields and then clicks on the UPDATE button, at which point
updates tblInvoiceData for this particular clientID.

HELP!!!

Dec 11 '06 #1
13 2414
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegroup s.com...
>I don't care how one suggests I do it, but I've been searching for days
on how to implement this concept. I'm trying to use some kind of grid
control (doesn't have to be a grid control, whatever works best) to
display a dropdown menu of fields populated from table tblInvoiceData.
This control also includes a textbox which the user can input a value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular field and
value displays in a grid (can be this original grid or another), BUT,
does not update the database tables until the user finshes adding all
their fields and then clicks on the UPDATE button, at which point
updates tblInvoiceData for this particular clientID.

HELP!!!

Dec 11 '06 #2
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegroup s.com...
I don't care how one suggests I do it, but I've been searching for days
on how to implement this concept. I'm trying to use some kind of grid
control (doesn't have to be a grid control, whatever works best) to
display a dropdown menu of fields populated from table tblInvoiceData.
This control also includes a textbox which the user can input a value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular field and
value displays in a grid (can be this original grid or another), BUT,
does not update the database tables until the user finshes adding all
their fields and then clicks on the UPDATE button, at which point
updates tblInvoiceData for this particular clientID.

HELP!!!
Dec 11 '06 #3
No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
>How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegrou ps.com...
>I don't care how one suggests I do it, but I've been searching for
days
on how to implement this concept. I'm trying to use some kind of
grid
control (doesn't have to be a grid control, whatever works best) to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input a
value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular field
and
value displays in a grid (can be this original grid or another),
BUT,
does not update the database tables until the user finshes adding
all
their fields and then clicks on the UPDATE button, at which point
updates tblInvoiceData for this particular clientID.

HELP!!!

Dec 11 '06 #4
look, I'm not going to argue about this. The whole point of stating my
initial problem was for someone to possibly suggest a concept or
method, if there's something already out there that does something like
this. If not, I gave a specific example of what I'm trying to do.
RobinS wrote:
No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegroup s.com...
I don't care how one suggests I do it, but I've been searching for
days
on how to implement this concept. I'm trying to use some kind of
grid
control (doesn't have to be a grid control, whatever works best) to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input a
value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular field
and
value displays in a grid (can be this original grid or another),
BUT,
does not update the database tables until the user finshes adding
all
their fields and then clicks on the UPDATE button, at which point
updates tblInvoiceData for this particular clientID.

HELP!!!
Dec 11 '06 #5
here's the code.

Dim cmdParam As SqlParameter
Dim ddlField As String = CType(e.Item.FindControl("ddlField"),
DropDownList).SelectedValue
Dim txtValue As String = CType(e.Item.FindControl("txtValue"),
TextBox).Text
Sub dgMassUpdate_Insert(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)

dsMassUpdate = Session("dsMassUpdate")
dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) = txtValue

SqlConn.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
dgMassUpdate.EditItemIndex = -1

dgTemp.DataSource = dsMassUpdate
dgTemp.DataSource = CreateDataSource(ddlField, txtValue)

End Sub

Function CreateDataSource(ByVal ddlField As String, ByVal txtValue
As String) As ICollection
Dim table As New DataTable
Dim tr As DataRow
Dim td As DataColumn
Dim newRow As DataRow
newRow = table.NewRow()

table.Columns.Add(New DataColumn(ddlField, GetType(String)))
table.Columns.Add(New DataColumn(txtValue, GetType(String)))

Dim dv As New DataView(table)
Return dv
End Function
RobinS wrote:
No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegroup s.com...
I don't care how one suggests I do it, but I've been searching for
days
on how to implement this concept. I'm trying to use some kind of
grid
control (doesn't have to be a grid control, whatever works best) to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input a
value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular field
and
value displays in a grid (can be this original grid or another),
BUT,
does not update the database tables until the user finshes adding
all
their fields and then clicks on the UPDATE button, at which point
updates tblInvoiceData for this particular clientID.

HELP!!!
Dec 11 '06 #6
oops, here it is again...

Sub dgMassUpdate_Insert(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim cmdParam As SqlParameter
Dim ddlField As String = CType(e.Item.FindControl("ddlField"),
DropDownList).SelectedValue
Dim txtValue As String = CType(e.Item.FindControl("txtValue"),
TextBox).Text

dsMassUpdate = Session("dsMassUpdate")
dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

SqlConn.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
dgMassUpdate.EditItemIndex = -1

dgTemp.DataSource = dsMassUpdate
dgTemp.DataSource = CreateDataSource(ddlField, txtValue)

End Sub

Function CreateDataSource(ByVal ddlField As String, ByVal txtValue
As String) As ICollection
Dim table As New DataTable
Dim tr As DataRow
Dim td As DataColumn
Dim newRow As DataRow
newRow = table.NewRow()

table.Columns.Add(New DataColumn(ddlField, GetType(String)))
table.Columns.Add(New DataColumn(txtValue, GetType(String)))

Dim dv As New DataView(table)
Return dv
End Function
RobinS wrote:
No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegroup s.com...
I don't care how one suggests I do it, but I've been searching for
days
on how to implement this concept. I'm trying to use some kind of
grid
control (doesn't have to be a grid control, whatever works best) to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input a
value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular field
and
value displays in a grid (can be this original grid or another),
BUT,
does not update the database tables until the user finshes adding
all
their fields and then clicks on the UPDATE button, at which point
updates tblInvoiceData for this particular clientID.

HELP!!!
Dec 11 '06 #7
Sub dgMassUpdate_Insert(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim cmdParam As SqlParameter
Dim ddlField As String = CType(e.Item.FindControl("ddlField"),
DropDownList).SelectedValue
Dim txtValue As String = CType(e.Item.FindControl("txtValue"),
TextBox).Text

dsMassUpdate = Session("dsMassUpdate")
dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

SqlConn.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")

dgTemp.DataSource = CreateDataSource(ddlField, txtValue)

End Sub

Function CreateDataSource(ByVal ddlField As String, ByVal txtValue
As String) As ICollection
Dim table As New DataTable
Dim tr As DataRow
Dim td As DataColumn
Dim newRow As DataRow
newRow = table.NewRow()

table.Columns.Add(New DataColumn(ddlField, GetType(String)))
table.Columns.Add(New DataColumn(txtValue, GetType(String)))

Dim dv As New DataView(table)
Return dv
End Function

Dec 11 '06 #8
Fair enough. I think it came across as one of those really
broad questions, and that's why you got the response you did.

I'll go look at your other posts, and if I can help you, I will.

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
look, I'm not going to argue about this. The whole point of stating
my
initial problem was for someone to possibly suggest a concept or
method, if there's something already out there that does something
like
this. If not, I gave a specific example of what I'm trying to do.
RobinS wrote:
>No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegr oups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegrou ps.com...
I don't care how one suggests I do it, but I've been searching
for
days
on how to implement this concept. I'm trying to use some kind
of
grid
control (doesn't have to be a grid control, whatever works best)
to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input a
value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular
field
and
value displays in a grid (can be this original grid or another),
BUT,
does not update the database tables until the user finshes
adding
all
their fields and then clicks on the UPDATE button, at which
point
updates tblInvoiceData for this particular clientID.

HELP!!!


Dec 11 '06 #9
Well, right off the bat, without completely understanding
everything, this looks like an issue:

dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

If you use Rows(0), it will always put it in the first row.

Is dbMassUpdate your data grid that you are inserting their
selection into? What is dgTemp?

If anybody else out there has an opinion, please feel free to
chime in!

Robin S.
-------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
oops, here it is again...

Sub dgMassUpdate_Insert(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim cmdParam As SqlParameter
Dim ddlField As String = CType(e.Item.FindControl("ddlField"),
DropDownList).SelectedValue
Dim txtValue As String = CType(e.Item.FindControl("txtValue"),
TextBox).Text

dsMassUpdate = Session("dsMassUpdate")
dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

SqlConn.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
dgMassUpdate.EditItemIndex = -1

dgTemp.DataSource = dsMassUpdate
dgTemp.DataSource = CreateDataSource(ddlField, txtValue)

End Sub

Function CreateDataSource(ByVal ddlField As String, ByVal txtValue
As String) As ICollection
Dim table As New DataTable
Dim tr As DataRow
Dim td As DataColumn
Dim newRow As DataRow
newRow = table.NewRow()

table.Columns.Add(New DataColumn(ddlField, GetType(String)))
table.Columns.Add(New DataColumn(txtValue, GetType(String)))

Dim dv As New DataView(table)
Return dv
End Function
RobinS wrote:
>No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegr oups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegrou ps.com...
I don't care how one suggests I do it, but I've been searching
for
days
on how to implement this concept. I'm trying to use some kind
of
grid
control (doesn't have to be a grid control, whatever works best)
to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input a
value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular
field
and
value displays in a grid (can be this original grid or another),
BUT,
does not update the database tables until the user finshes
adding
all
their fields and then clicks on the UPDATE button, at which
point
updates tblInvoiceData for this particular clientID.

HELP!!!


Dec 11 '06 #10
my main dataset is dsMassUpdate which I fill early in early piece of
the code. dgMassUpdate is the first datagrid, where I'm performing the
update to the dataset. dgTemp is the second datagrid which gets
populated with the field and value from the first datagrid.

What I'm trying to do is allow the user to update each field with a
value they enter by updating the dataset and not the database. When
the user is finally finished with selecting all the fields and adding
values for the field to be updated with, THEN they hit the UPDATE
button which updates the db.

The purpose of the second datagrid was just to display what fields and
values the user selected and entered. This data doesn't actually get
updated to the database immediately.

RobinS wrote:
Well, right off the bat, without completely understanding
everything, this looks like an issue:

dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

If you use Rows(0), it will always put it in the first row.

Is dbMassUpdate your data grid that you are inserting their
selection into? What is dgTemp?

If anybody else out there has an opinion, please feel free to
chime in!

Robin S.
-------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
oops, here it is again...

Sub dgMassUpdate_Insert(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim cmdParam As SqlParameter
Dim ddlField As String = CType(e.Item.FindControl("ddlField"),
DropDownList).SelectedValue
Dim txtValue As String = CType(e.Item.FindControl("txtValue"),
TextBox).Text

dsMassUpdate = Session("dsMassUpdate")
dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

SqlConn.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
dgMassUpdate.EditItemIndex = -1

dgTemp.DataSource = dsMassUpdate
dgTemp.DataSource = CreateDataSource(ddlField, txtValue)

End Sub

Function CreateDataSource(ByVal ddlField As String, ByVal txtValue
As String) As ICollection
Dim table As New DataTable
Dim tr As DataRow
Dim td As DataColumn
Dim newRow As DataRow
newRow = table.NewRow()

table.Columns.Add(New DataColumn(ddlField, GetType(String)))
table.Columns.Add(New DataColumn(txtValue, GetType(String)))

Dim dv As New DataView(table)
Return dv
End Function
RobinS wrote:
No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegroup s.com...
I don't care how one suggests I do it, but I've been searching
for
days
on how to implement this concept. I'm trying to use some kind
of
grid
control (doesn't have to be a grid control, whatever works best)
to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input a
value.
These two columns are side by side and not in a vertical layout.

The user then clicks on the "add" button and that particular
field
and
value displays in a grid (can be this original grid or another),
BUT,
does not update the database tables until the user finshes
adding
all
their fields and then clicks on the UPDATE button, at which
point
updates tblInvoiceData for this particular clientID.

HELP!!!
Dec 11 '06 #11
Okay, let me try this again:

dsMassUpdate is your actual dataset that is going to be updated?

dgMassUpdate is a datagrid that shows the dataset dsMassUpdate?
Or does it show a list of fields in dsMassUpdate? So they pick
a field name and put the new value in the textbox and click a
button and it adds it to dgTemp?

Then when they're done, they apply all the updates to the
dataset dsMassUpdate?

Am I understanding your process yet?

Robin S.
-------------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
my main dataset is dsMassUpdate which I fill early in early piece of
the code. dgMassUpdate is the first datagrid, where I'm performing
the
update to the dataset. dgTemp is the second datagrid which gets
populated with the field and value from the first datagrid.

What I'm trying to do is allow the user to update each field with a
value they enter by updating the dataset and not the database. When
the user is finally finished with selecting all the fields and adding
values for the field to be updated with, THEN they hit the UPDATE
button which updates the db.

The purpose of the second datagrid was just to display what fields and
values the user selected and entered. This data doesn't actually get
updated to the database immediately.

RobinS wrote:
>Well, right off the bat, without completely understanding
everything, this looks like an issue:

dsMassUpdate.Tables("MassUpdate").Rows(0).Item(dd lField) =
txtValue

If you use Rows(0), it will always put it in the first row.

Is dbMassUpdate your data grid that you are inserting their
selection into? What is dgTemp?

If anybody else out there has an opinion, please feel free to
chime in!

Robin S.
-------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@j72g2000cwa.googleg roups.com...
oops, here it is again...

Sub dgMassUpdate_Insert(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim cmdParam As SqlParameter
Dim ddlField As String =
CType(e.Item.FindControl("ddlField"),
DropDownList).SelectedValue
Dim txtValue As String =
CType(e.Item.FindControl("txtValue"),
TextBox).Text

dsMassUpdate = Session("dsMassUpdate")
dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

SqlConn.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
dgMassUpdate.EditItemIndex = -1

dgTemp.DataSource = dsMassUpdate
dgTemp.DataSource = CreateDataSource(ddlField, txtValue)

End Sub

Function CreateDataSource(ByVal ddlField As String, ByVal
txtValue
As String) As ICollection
Dim table As New DataTable
Dim tr As DataRow
Dim td As DataColumn
Dim newRow As DataRow
newRow = table.NewRow()

table.Columns.Add(New DataColumn(ddlField, GetType(String)))
table.Columns.Add(New DataColumn(txtValue, GetType(String)))

Dim dv As New DataView(table)
Return dv
End Function
RobinS wrote:
No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegr oups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but
the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegrou ps.com...
I don't care how one suggests I do it, but I've been searching
for
days
on how to implement this concept. I'm trying to use some
kind
of
grid
control (doesn't have to be a grid control, whatever works
best)
to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input
a
value.
These two columns are side by side and not in a vertical
layout.

The user then clicks on the "add" button and that particular
field
and
value displays in a grid (can be this original grid or
another),
BUT,
does not update the database tables until the user finshes
adding
all
their fields and then clicks on the UPDATE button, at which
point
updates tblInvoiceData for this particular clientID.

HELP!!!

Dec 12 '06 #12
That is correct.

RobinS wrote:
Okay, let me try this again:

dsMassUpdate is your actual dataset that is going to be updated?

dgMassUpdate is a datagrid that shows the dataset dsMassUpdate?
Or does it show a list of fields in dsMassUpdate? So they pick
a field name and put the new value in the textbox and click a
button and it adds it to dgTemp?

Then when they're done, they apply all the updates to the
dataset dsMassUpdate?

Am I understanding your process yet?

Robin S.
-------------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
my main dataset is dsMassUpdate which I fill early in early piece of
the code. dgMassUpdate is the first datagrid, where I'm performing
the
update to the dataset. dgTemp is the second datagrid which gets
populated with the field and value from the first datagrid.

What I'm trying to do is allow the user to update each field with a
value they enter by updating the dataset and not the database. When
the user is finally finished with selecting all the fields and adding
values for the field to be updated with, THEN they hit the UPDATE
button which updates the db.

The purpose of the second datagrid was just to display what fields and
values the user selected and entered. This data doesn't actually get
updated to the database immediately.

RobinS wrote:
Well, right off the bat, without completely understanding
everything, this looks like an issue:

dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

If you use Rows(0), it will always put it in the first row.

Is dbMassUpdate your data grid that you are inserting their
selection into? What is dgTemp?

If anybody else out there has an opinion, please feel free to
chime in!

Robin S.
-------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
oops, here it is again...

Sub dgMassUpdate_Insert(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim cmdParam As SqlParameter
Dim ddlField As String =
CType(e.Item.FindControl("ddlField"),
DropDownList).SelectedValue
Dim txtValue As String =
CType(e.Item.FindControl("txtValue"),
TextBox).Text

dsMassUpdate = Session("dsMassUpdate")
dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

SqlConn.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
dgMassUpdate.EditItemIndex = -1

dgTemp.DataSource = dsMassUpdate
dgTemp.DataSource = CreateDataSource(ddlField, txtValue)

End Sub

Function CreateDataSource(ByVal ddlField As String, ByVal
txtValue
As String) As ICollection
Dim table As New DataTable
Dim tr As DataRow
Dim td As DataColumn
Dim newRow As DataRow
newRow = table.NewRow()

table.Columns.Add(New DataColumn(ddlField, GetType(String)))
table.Columns.Add(New DataColumn(txtValue, GetType(String)))

Dim dv As New DataView(table)
Return dv
End Function
RobinS wrote:
No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but
the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegroup s.com...
I don't care how one suggests I do it, but I've been searching
for
days
on how to implement this concept. I'm trying to use some
kind
of
grid
control (doesn't have to be a grid control, whatever works
best)
to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input
a
value.
These two columns are side by side and not in a vertical
layout.

The user then clicks on the "add" button and that particular
field
and
value displays in a grid (can be this original grid or
another),
BUT,
does not update the database tables until the user finshes
adding
all
their fields and then clicks on the UPDATE button, at which
point
updates tblInvoiceData for this particular clientID.

HELP!!!

Dec 12 '06 #13
Yes, dgMassUpdate binds the query that holds all the fields that are
populated in the dropdownlist. dgMassUpdate doesn't actually list
anything. The only thing dgMassUpdate does, event wise, is fire
dgMassUpdate_Insert(). And Yes, you are correct, that event then calls
CreateDataSource(). And then the update button does a update of all
the fields and values they've entered. Would you like me to send you
the actual code, so you can see it?

Thanks, I appreciate the help!

RobinS wrote:
Okay, let me try this again:

dsMassUpdate is your actual dataset that is going to be updated?

dgMassUpdate is a datagrid that shows the dataset dsMassUpdate?
Or does it show a list of fields in dsMassUpdate? So they pick
a field name and put the new value in the textbox and click a
button and it adds it to dgTemp?

Then when they're done, they apply all the updates to the
dataset dsMassUpdate?

Am I understanding your process yet?

Robin S.
-------------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
my main dataset is dsMassUpdate which I fill early in early piece of
the code. dgMassUpdate is the first datagrid, where I'm performing
the
update to the dataset. dgTemp is the second datagrid which gets
populated with the field and value from the first datagrid.

What I'm trying to do is allow the user to update each field with a
value they enter by updating the dataset and not the database. When
the user is finally finished with selecting all the fields and adding
values for the field to be updated with, THEN they hit the UPDATE
button which updates the db.

The purpose of the second datagrid was just to display what fields and
values the user selected and entered. This data doesn't actually get
updated to the database immediately.

RobinS wrote:
Well, right off the bat, without completely understanding
everything, this looks like an issue:

dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

If you use Rows(0), it will always put it in the first row.

Is dbMassUpdate your data grid that you are inserting their
selection into? What is dgTemp?

If anybody else out there has an opinion, please feel free to
chime in!

Robin S.
-------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
oops, here it is again...

Sub dgMassUpdate_Insert(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim cmdParam As SqlParameter
Dim ddlField As String =
CType(e.Item.FindControl("ddlField"),
DropDownList).SelectedValue
Dim txtValue As String =
CType(e.Item.FindControl("txtValue"),
TextBox).Text

dsMassUpdate = Session("dsMassUpdate")
dsMassUpdate.Tables("MassUpdate").Rows(0).Item(ddl Field) =
txtValue

SqlConn.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
dgMassUpdate.EditItemIndex = -1

dgTemp.DataSource = dsMassUpdate
dgTemp.DataSource = CreateDataSource(ddlField, txtValue)

End Sub

Function CreateDataSource(ByVal ddlField As String, ByVal
txtValue
As String) As ICollection
Dim table As New DataTable
Dim tr As DataRow
Dim td As DataColumn
Dim newRow As DataRow
newRow = table.NewRow()

table.Columns.Add(New DataColumn(ddlField, GetType(String)))
table.Columns.Add(New DataColumn(txtValue, GetType(String)))

Dim dv As New DataView(table)
Return dv
End Function
RobinS wrote:
No, you're asking too broad a question. It's like someone
posted a question "Tell me about Windows Forms". Or "Tell me
about ADO.Net". Well, there are books of over a thousand
pages, how do you answer that in a newsgroup? Go buy a book.

This is a more specific question. Are you adding a row
to the 2nd grid before putting the values in? How are you
putting the values in / adding the information to the grid?
Post that code, and we can help you with it.

Robin S.
----------------------------------------
<sh*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Moreso, I think his response is saying I'm asking too specific a
question. I've actually done what you've described there, but
the
problem with that is once the user tries to add another item, it
replaces the first value added to the 2nd grid.

RobinS wrote:
How many times are you going to re-post this? Cor's response
means this: You are asking too broad a question.

If the first control has only one value, use a combobox.
Bind it to your tblInvoiceData. Put a textbox next to it.
Put a button next to that. Add an event handler to the
button.

Put a grid on the bottom. When they click on the <Addbutton,
add a record to the grid.

I think that's what you're going for. Tackle the problems
one at a time. It seems like you're asking us to write the
whole thing for you. I'd do that for you, but you'll have
to send me a billing address... ;-)

Robin S.
-----------------------------
<sh*****@gmail.comwrote in message
news:11********************@73g2000cwn.googlegroup s.com...
I don't care how one suggests I do it, but I've been searching
for
days
on how to implement this concept. I'm trying to use some
kind
of
grid
control (doesn't have to be a grid control, whatever works
best)
to
display a dropdown menu of fields populated from table
tblInvoiceData.
This control also includes a textbox which the user can input
a
value.
These two columns are side by side and not in a vertical
layout.

The user then clicks on the "add" button and that particular
field
and
value displays in a grid (can be this original grid or
another),
BUT,
does not update the database tables until the user finshes
adding
all
their fields and then clicks on the UPDATE button, at which
point
updates tblInvoiceData for this particular clientID.

HELP!!!

Dec 12 '06 #14

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

Similar topics

7
by: Pierluigi Terzoli | last post by:
Hi everybody, I need help for this problem: I'm using a DataGrid to Insert/Modify/Cancel data from a single table. At the moment, every cell modification of a pre-existing row is correctly update...
0
by: Christopher | last post by:
I AM GETTING A SYSTEM.DATA.SQLCLIENT.SQLEXCEPTION ERROR WHEN ATTEMPTING TO INSERT DATA INTO A SINGLE TABLE THROUGH A GRID //If this is due to a spelling error, i will //inflict a ritual...
8
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid. This Datagrid is filled with the data of a SQL table. I have a...
5
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and...
3
by: Larry Woods | last post by:
I have a datagrid that is carrying all fields of a record...except one. Now I want to update the underlying database via a dataadapter. The update is working but the field that is "left out" is...
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
3
by: Jim | last post by:
I have a datagrid with a DataAdapter as the DataSource. The user fills in their data for 3 columns and I want to programically add a value to the 4th (invisible) column (employee number). That way...
0
by: Erik | last post by:
Why isn't my update method getting called? Pasted below is an aspx from a 1.1 application I'm working on. It has two textboxes and a button for inserting data into the database, and a datagrid...
5
by: rcoco | last post by:
Hi, I'm working on a asp.net project with a datagrid. I want the user to be adding data into Sql database using the datagrid. So I'm using a ListBox to do this and edit update and delete. I placed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.