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 1257
szabelin wrote: Hi, I was wondering if there is a way to have a BoundColumn in DataGrid, but not display it?
<asp:BoundColum n 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:BoundColu mn 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(ob ject source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
string str1 = this.grid.Items
[e.Item.ItemInde x].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@szabe lin> 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:BoundColu mn 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:boundcolum n visible="False" datafield="pk_E ntryId"></asp:boundcolumn >
and here's how I get the value:
Dim EntryId As Int32 = CType(DataGrid1 .SelectedItem.C ells(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@szabe lin> 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(ob ject source, System.Web.UI.W ebControls.Data GridCommandEven tArgs e) { string str1 = this.grid.Items [e.Item.ItemInde x].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 JOIN
CardHolder ON Card.CardHolderID =
CardHolder.RecordID
WHERE (Card.Deleted = 0) AND (History.GenTime IS NOT NULL)
ORDER BY CardHolder.RecordID, History.GenTime DESC
|
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.
What I need is to hide all of the datagrid if there are no records.
|
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 data grid with the db:
public static void DataGrid(DataGrid DG,string sql)
{
//Initialize connection with the db
|
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 anyway to do 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
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
|
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 windows form, then in the coding i put :
"select * from table where balance <50";
it should display only items below 50, but when there isn't any(all items are above 50), i want to hide the datagrid....is there a way to do this?
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |