By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,402 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,402 IT Pros & Developers. It's quick & easy.

Handling not visible DataGrid objects

P: n/a
I have a datagrid that has objects that are not visible and I need to use
them in my Sql Statement.

The problem is they are not there when set as "visible=false", but they are
if set to true.

For example:

I have:
************************************************** ***************************************
<asp:BoundColumn DataField="Answer"
HeaderText="Answer"></asp:BoundColumn>
<asp:BoundColumn DataField="PositionID" visible="false"
HeaderText="PositionID"></asp:BoundColumn>
<asp:BoundColumn DataField="QuestionUnique"
visible="false" HeaderText="QuestionUnique"></asp:BoundColumn>
<asp:BoundColumn DataField="AnswerUnique" visible="false"
HeaderText="AnswerUnique"></asp:BoundColumn>
************************************************** *****************************************

Where only "Answer" is visible - the others are key fields that I need for
my Sql and don't really want them displayed.

In my update routine:
************************************************** ****************************************
Sub DataUpdate(S as Object, E as DataGridCommandEventArgs)
Dim oGrid as DataGrid = CType(S, DataGrid)
oGrid.EditItemIndex=Cint(E.Item.ItemIndex)
dim pc as TextBox = e.item.Cells(1).controls(0)
dim quc as TextBox = e.Item.Cells(2).controls(0)
dim auc as TextBox = e.Item.Cells(3).controls(0)
dim txtAnswer as TextBox=E.Item.Cells(0).Controls(0)
Dim sQuery as String = "SELECT TOP 6
Answer,PositionID,QuestionUnique,AnswerUnique from ScreenAnswers where
PositionID = '" & pc.text & "' and QuestionUnique = '" & quc.text & "'"
************************************************** ****************************************

This works fine if "pc", "quc" and "auc" have visibility set to true.

Then sQuery = Update ScreenAnswers set Answer = 'Oracle' where PositionID
= '' and QuestionUnique = '' and AnswerUnique = ''

If visibility is set to false,

Then sQuery = Update ScreenAnswers set Answer = 'Oracle' where PositionID =
'25' and QuestionUnique = '3' and AnswerUnique = '3'

How do I handle this?

Thanks,

Tom
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"tshad" <ts**********@ftsolutions.com> wrote in message
news:uj**************@TK2MSFTNGP12.phx.gbl...
I have a datagrid that has objects that are not visible and I need to use
them in my Sql Statement.
Also, this is in the onUpdateCommand routine.

The problem is they are not there when set as "visible=false", but they
are if set to true.

For example:

I have:
************************************************** ***************************************
<asp:BoundColumn DataField="Answer"
HeaderText="Answer"></asp:BoundColumn>
<asp:BoundColumn DataField="PositionID" visible="false"
HeaderText="PositionID"></asp:BoundColumn>
<asp:BoundColumn DataField="QuestionUnique"
visible="false" HeaderText="QuestionUnique"></asp:BoundColumn>
<asp:BoundColumn DataField="AnswerUnique"
visible="false" HeaderText="AnswerUnique"></asp:BoundColumn>
************************************************** *****************************************

Where only "Answer" is visible - the others are key fields that I need for
my Sql and don't really want them displayed.

In my update routine:
************************************************** ****************************************
Sub DataUpdate(S as Object, E as DataGridCommandEventArgs)
Dim oGrid as DataGrid = CType(S, DataGrid)
oGrid.EditItemIndex=Cint(E.Item.ItemIndex)
dim pc as TextBox = e.item.Cells(1).controls(0)
dim quc as TextBox = e.Item.Cells(2).controls(0)
dim auc as TextBox = e.Item.Cells(3).controls(0)
dim txtAnswer as TextBox=E.Item.Cells(0).Controls(0)
Dim sQuery as String = "SELECT TOP 6
Answer,PositionID,QuestionUnique,AnswerUnique from ScreenAnswers where
PositionID = '" & pc.text & "' and QuestionUnique = '" & quc.text & "'"
************************************************** ****************************************

This works fine if "pc", "quc" and "auc" have visibility set to true.

Then sQuery = Update ScreenAnswers set Answer = 'Oracle' where
PositionID = '' and QuestionUnique = '' and AnswerUnique = ''

If visibility is set to false,

Then sQuery = Update ScreenAnswers set Answer = 'Oracle' where PositionID
= '25' and QuestionUnique = '3' and AnswerUnique = '3'

How do I handle this?

Thanks,

Tom

Nov 18 '05 #2

P: n/a
Never mind.

I just figured it out.

All I had to do was set all the fields that were invisible to ReadOnly and
then everything worked fine.

Tom.
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eS**************@TK2MSFTNGP14.phx.gbl...
"tshad" <ts**********@ftsolutions.com> wrote in message
news:uj**************@TK2MSFTNGP12.phx.gbl...
I have a datagrid that has objects that are not visible and I need to use
them in my Sql Statement.


Also, this is in the onUpdateCommand routine.

The problem is they are not there when set as "visible=false", but they
are if set to true.

For example:

I have:
************************************************** ***************************************
<asp:BoundColumn DataField="Answer"
HeaderText="Answer"></asp:BoundColumn>
<asp:BoundColumn DataField="PositionID" visible="false"
HeaderText="PositionID"></asp:BoundColumn>
<asp:BoundColumn DataField="QuestionUnique"
visible="false" HeaderText="QuestionUnique"></asp:BoundColumn>
<asp:BoundColumn DataField="AnswerUnique"
visible="false" HeaderText="AnswerUnique"></asp:BoundColumn>
************************************************** *****************************************

Where only "Answer" is visible - the others are key fields that I need
for my Sql and don't really want them displayed.

In my update routine:
************************************************** ****************************************
Sub DataUpdate(S as Object, E as DataGridCommandEventArgs)
Dim oGrid as DataGrid = CType(S, DataGrid)
oGrid.EditItemIndex=Cint(E.Item.ItemIndex)
dim pc as TextBox = e.item.Cells(1).controls(0)
dim quc as TextBox = e.Item.Cells(2).controls(0)
dim auc as TextBox = e.Item.Cells(3).controls(0)
dim txtAnswer as TextBox=E.Item.Cells(0).Controls(0)
Dim sQuery as String = "SELECT TOP 6
Answer,PositionID,QuestionUnique,AnswerUnique from ScreenAnswers where
PositionID = '" & pc.text & "' and QuestionUnique = '" & quc.text & "'"
************************************************** ****************************************

This works fine if "pc", "quc" and "auc" have visibility set to true.

Then sQuery = Update ScreenAnswers set Answer = 'Oracle' where
PositionID = '' and QuestionUnique = '' and AnswerUnique = ''

If visibility is set to false,

Then sQuery = Update ScreenAnswers set Answer = 'Oracle' where
PositionID = '25' and QuestionUnique = '3' and AnswerUnique = '3'

How do I handle this?

Thanks,

Tom


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.