473,399 Members | 3,832 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,399 software developers and data experts.

Handling not visible DataGrid objects

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
2 1284
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: tshad | last post by:
I have a datagrid that I want to add a new column to. This column will only be visible under certain conditions. So I want to set the column visible=false. Then when the right condition happens...
2
by: Randall Parker | last post by:
One can set individual controls in Code Behind by giving the controls ID names and then declaring corresponding objects for them in Code Behind and then setting Visible = false or true for each...
7
by: GaryDean | last post by:
(one of our developers posted this and it got no answer so I'm giving it another try) I'm converting a DataGrid utility component that previously used the columns array to function as it has in...
7
by: RolfHerbert | last post by:
Hi all, Source code below. I am using an sqldatasorce to populate a datagrid. I am using datakeyIds. I am interested in two keys which I have added to the datakeyids, however if either of the...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.