Handling not visible DataGrid objects

T

tshad

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
 
T

tshad

tshad said:
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.
 
T

tshad

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top