Hi, I was wondering if there is a way to have a
BoundColumn in DataGrid, but not display it? Basically I
would like to have a primary key hidden (and I need this
for edits and deletes).
I know I could store DataSet in the viewstate or session,
but I was just curios if DataGrid offers something (kind
of like Stringray's grid allowing you to associate a row
with data in a void* )
Thanks 6 1237
szabelin wrote: Hi, I was wondering if there is a way to have a BoundColumn in DataGrid, but not display it?
<asp:BoundColumn Visible="False" ...>
--
There are 10 kinds of people. Those who understand binary and those who
don't. http://code.acadx.com
That was the first thing I tried. I didn't work, text
values are "", maybe this has to do with the fact that asp
does not generate code for invisible controls. Have you
tried it? -----Original Message----- szabelin wrote: Hi, I was wondering if there is a way to have a BoundColumn in DataGrid, but not display it? <asp:BoundColumn Visible="False" ...>
-- There are 10 kinds of people. Those who understand binary
and those whodon't.
http://code.acadx.com
.
szabelin wrote: That was the first thing I tried. I didn't work, text values are "", maybe this has to do with the fact that asp does not generate code for invisible controls. Have you tried it?
Yes. Assuming the column in question is the first column in the grid,
the following text returns the primary key value for a given record:
string id = DataGrid1.Items[x].Cells[0].Text;
--
There are 10 kinds of people. Those who understand binary and those who
don't. http://code.acadx.com
Hm.. you must be doing something else because both str1
and str2 are empty (see code below). I am wondering if
there is an object type per row property built-into the
DataGrid, so developers don't have to "cheat" creating a
hidden column...
private void OnGridUpdate(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string str1 = this.grid.Items
[e.Item.ItemIndex].Cells[0].Text;
string str2 = e.Item.Cells[0].Text;
.....
} -----Original Message----- szabelin wrote: That was the first thing I tried. I didn't work, text values are "", maybe this has to do with the fact that
asp does not generate code for invisible controls. Have you tried it? Yes. Assuming the column in question is the first column
in the grid,the following text returns the primary key value for a
given record: string id = DataGrid1.Items[x].Cells[0].Text;
-- There are 10 kinds of people. Those who understand binary
and those whodon't.
http://code.acadx.com
.
Invisible controls are not rendered, that's correct. Can't you use hidden
fields for the record ids?
Jerry
"szabelin" <szabelin@szabelin> wrote in message
news:04****************************@phx.gbl... That was the first thing I tried. I didn't work, text values are "", maybe this has to do with the fact that asp does not generate code for invisible controls. Have you tried it?
-----Original Message----- szabelin wrote: Hi, I was wondering if there is a way to have a BoundColumn in DataGrid, but not display it?
<asp:BoundColumn Visible="False" ...>
-- There are 10 kinds of people. Those who understand binary and those whodon't.
http://code.acadx.com
.
szabelin,
I'm using a hidden field for my item ids in a datagrid and it's working
fine.
Here's the column from the datagrid:
<asp:boundcolumn visible="False" datafield="pk_EntryId"></asp:boundcolumn>
and here's how I get the value:
Dim EntryId As Int32 = CType(DataGrid1.SelectedItem.Cells(0).Text, Int32)
So you can get it to work.
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"szabelin" <szabelin@szabelin> wrote in message
news:05****************************@phx.gbl... Hm.. you must be doing something else because both str1 and str2 are empty (see code below). I am wondering if there is an object type per row property built-into the DataGrid, so developers don't have to "cheat" creating a hidden column...
private void OnGridUpdate(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { string str1 = this.grid.Items [e.Item.ItemIndex].Cells[0].Text; string str2 = e.Item.Cells[0].Text;
....
}
-----Original Message----- szabelin wrote: That was the first thing I tried. I didn't work, text values are "", maybe this has to do with the fact that asp does not generate code for invisible controls. Have you tried it?
Yes. Assuming the column in question is the first column in the grid,the following text returns the primary key value for a given record: string id = DataGrid1.Items[x].Cells[0].Text;
-- There are 10 kinds of people. Those who understand binary
and those whodon't.
http://code.acadx.com
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DaveHayzen |
last post by:
The following SQL query :-
SELECT CardHolder.RecordID, History.GenTime, History.Link1
FROM History FULL OUTER JOIN
Card ON History.Param3 =
LTRIM(RTRIM(Card.CardNumber)) FULL OUTER...
|
by: Payson Books |
last post by:
Where can I find some info on grabbing the recordID of the last record,
incrementing it by one, and using the new number in a new record.
|
by: jez123456 |
last post by:
Not sure if I'm in the right thread but here goes.
I have an ASP.Net web page with a datagrid. The code behind is C#.
If the datagrid has no records the datagrid header section is still shown....
|
by: Das |
last post by:
Hi everyone,
I'm using datagrid control to display the data. I want to hide column to be
displayed into the data grid. I'm using the code as given below:
Method given below is used to bind the...
|
by: Hanson |
last post by:
I have a datagrid control in an aspx page. The datagrid columns will be
dynamically generated according to the pre-page's search condition, I want
to hide some columns in the datagrid. is that...
|
by: sivaraman.S |
last post by:
Hi friends,
How to hide a column in datagrid.
regards,
Sivaraman.S
|
by: J |
last post by:
Ok, they have changed a lot of stuff in VB.net. How in the world do you hide a column on the Datagrid?
--
Jason
|
by: nuhura01 |
last post by:
Hi all..
I have a datagrid in my system and I preview the datagrid in other
html page. Below are the code that I'm using:
Dim oStringWriter As System.IO.StringWriter = New...
|
by: wassssup |
last post by:
i want to know is there a way to check wherether is there data inside a datagrid and hide the datagrid when there isn't any.
for example i drag the datagridview from the toolbox and put it on the...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |