473,847 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

column in dataGrid

I have template column in dataGrid and visible=false.

<asp:TemplateCo lumn visible=false>
<ItemTemplate>< asp:CheckBox Runat=server ID=chkExists Checked='<%# Container.DataI tem( "obstaja" ) % >'></asp:CheckBox>
</ItemTemplate>
</asp:TemplateCol umn>

When user clicks link button in dataGrid I check the chkExists value:

Private Sub dgdAdvert_ItemC ommand(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles dgdAdvert.ItemC ommand

If e.CommandName = "AdvName" Then
exists = CType(e.Item.Ce lls(5).Controls (0), CheckBox).Check ed
...
...
end if
end sub
If exists=true then I disable some fields for update.

If I have <asp:TemplateCo lumn visible=false> then exists is always false.

If I have <asp:TemplateCo lumn visible=true> then it works fine, exists is true or false.

But I don't want that user see the template column, I have it only for checking the exists value.
Where is the problem?

Thank you,

Simon
Nov 18 '05 #1
2 1386
If a column has visible = false then it isn't rendered at all. Maybe you can bind the enabled property of your update controls to a column which you create in your datatable (assuming that this is what is bound to the datagrid). Set the value of the item in the column accordingly.
"simon" <si*********@st ud-moderna.si> wrote in message news:u%******** ********@TK2MSF TNGP12.phx.gbl. ..
I have template column in dataGrid and visible=false.

<asp:TemplateCo lumn visible=false>
<ItemTemplate>< asp:CheckBox Runat=server ID=chkExists Checked='<%# Container.DataI tem( "obstaja" ) % >'></asp:CheckBox>
</ItemTemplate>
</asp:TemplateCol umn>

When user clicks link button in dataGrid I check the chkExists value:

Private Sub dgdAdvert_ItemC ommand(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles dgdAdvert.ItemC ommand

If e.CommandName = "AdvName" Then
exists = CType(e.Item.Ce lls(5).Controls (0), CheckBox).Check ed
...
...
end if
end sub
If exists=true then I disable some fields for update.

If I have <asp:TemplateCo lumn visible=false> then exists is always false.

If I have <asp:TemplateCo lumn visible=true> then it works fine, exists is true or false.

But I don't want that user see the template column, I have it only for checking the exists value.
Where is the problem?

Thank you,

Simon
Nov 18 '05 #2
I use the same update controls also for inserts.
When user click the update, I enable/disable them regarding to the chkExists column,
If user clicks INSERT, I enable all controls.
So I need somehow to know, if the row exists or not.
I thought I could solve this by template column and checkBox and visible=false.

Is there any other solution?

Thank you,
Simon
"Rick Spiewak" <ri*********@mi ndspring.com> wrote in message news:Ol******** ******@TK2MSFTN GP12.phx.gbl...
If a column has visible = false then it isn't rendered at all. Maybe you can bind the enabled property of your update controls to a column which you create in your datatable (assuming that this is what is bound to the datagrid). Set the value of the item in the column accordingly.
"simon" <si*********@st ud-moderna.si> wrote in message news:u%******** ********@TK2MSF TNGP12.phx.gbl. ..
I have template column in dataGrid and visible=false.

<asp:TemplateCo lumn visible=false>
<ItemTemplate>< asp:CheckBox Runat=server ID=chkExists Checked='<%# Container.DataI tem( "obstaja" ) % >'></asp:CheckBox>
</ItemTemplate>
</asp:TemplateCol umn>

When user clicks link button in dataGrid I check the chkExists value:

Private Sub dgdAdvert_ItemC ommand(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles dgdAdvert.ItemC ommand

If e.CommandName = "AdvName" Then
exists = CType(e.Item.Ce lls(5).Controls (0), CheckBox).Check ed
...
...
end if
end sub
If exists=true then I disable some fields for update.

If I have <asp:TemplateCo lumn visible=false> then exists is always false.

If I have <asp:TemplateCo lumn visible=true> then it works fine, exists is true or false.

But I don't want that user see the template column, I have it only for checking the exists value.
Where is the problem?

Thank you,

Simon
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4873
by: PeterZ | last post by:
Hi, In a running C# app with a datagrid control I select all rows in the dataGrid using CTRL-A, I then paste into some other app like notepad or Word but the column headings get left off. Is there any way of including column headings when copying/pasting from a running datagrid to notepad? At this stage it looks like I have to write my own code but would rather not if someone knows how to do it.
6
3251
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order entry application. The code below gets line items from a SQL Server database and returns them to a datagrid by way of a DataTable called lineTable. As long as I am just displaying columns in the SQL database everything works well. I now want...
0
2668
by: Amber | last post by:
There are times when you will need to highlight or otherwise modify the contents of a particular DataGrid row-column value based upon the value in the column. In this example we will select the CompanyName, ContactName, and ContactTitle columns from the Customers table in the Northwind database. Whenever the value of ContactTitle equals "Owner" we will change the font color to red. We can do this by using an ItemTemplate where we have...
1
2487
by: Drew | last post by:
Hey, thanks in advance for helping me out with my problem: I have a datagrid which is embedded in another datagrid. The datagrid is filled directly by a dataset generated from a sql query. So far everything is fine. Now i try to format the embedded datagrid - e.g. setting font size and the column size/width of each column. Everything is working fine, except the width of the columns.
6
2752
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is freeze.
10
4961
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than the column order of the datatable). I also allow the user to click on a column header to sort the datagrid by that column. I need to identify the row and column in the datatable when the user clicks on a cell in the datagrid. Using the...
5
3703
by: Rich | last post by:
I have a datagrid that uses a dataview object for its datasource. The dataview contains a unique row identifier column. I don't want to display this column in the datagrid. I need the unique row Identifier column so that I can run updates on the SqlAdapter object. Is there a way to hide this column from the datagrid? Dim dv1 As New DataView(ds.Tables("tbl1")) dv1.AllowNew = False dgr1.DataSource = dv1 '--dgr1 is the datagrid
3
3557
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I can get this to work; however, the column header on the datagrid is not a link/sortable. What am I missing? Thanks in advance.
10
2357
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option. If the user right clicks on a column heading can I highlight that column and then delete it? I'm not exactly sure how to highlight it or figure out what column has been clicked. In my testing so far when I use the context menu I always get the...
4
2926
by: gane | last post by:
Hi, I am creating datagrid bound column dynamically and need to check if a datagrid column already exists?Is there a way to check this? thanks gane
0
9892
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, 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...
0
9734
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,...
0
10991
Oralloy
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...
0
10653
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10718
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,...
0
10347
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7888
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 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...
0
7061
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.