472,127 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 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 2322
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Pierluigi Terzoli | last post: by
reply views Thread by Christopher | last post: by
8 posts views Thread by Inigo Jimenez | last post: by
5 posts views Thread by Chris | last post: by
reply views Thread by Wyatt70 | last post: by
5 posts views Thread by rcoco | last post: by

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.