473,395 Members | 1,541 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,395 software developers and data experts.

GridView column

HI ALL:

I have a gridview and display 4 columns , one of the column is ID , which i
don't wanna to visible. The problem i got is that the update , insert and
delet function doesn't work if i set the ID column visiable to false.

How can i handle this case?

Cheers

Nick
Oct 5 '06 #1
3 1437

hello Nick

There are two things you should do.

For insert operations, set

InsertVisible=false

http://authors.aspalliance.com/aspxt...tailsview.aspx

For update operations, do not include the primary key field in the
GridView, or set

ReadOnly=true

http://authors.aspalliance.com/aspxt...ngridview.aspx

Oct 5 '06 #2
Hi Nick

Easy solution:
Include Visible="False" in te column of the ID
See below:
Guy
===========================
<asp:GridView ID="gridBlackListStrings" runat="server" AllowSorting="True"
AutoGenerateColumns="False" AutoGenerateSelectButton="True"
DataKeyNames="BlacklistStringID" DataSourceID="sqlBlackListStrings">

<Columns>

<asp:BoundField DataField="BlacklistStringID" visible="false"
HeaderText="BlacklistStringID" InsertVisible="False" ReadOnly="True"
SortExpression="BlacklistStringID" />

<asp:BoundField DataField="BlackListString" HeaderText="BlackListString"
SortExpression="BlackListString" />

</Columns>

</asp:GridView>

===========================
"Nick" <Ni**@discussions.microsoft.comwrote in message
news:8A**********************************@microsof t.com...
HI ALL:

I have a gridview and display 4 columns , one of the column is ID , which
i
don't wanna to visible. The problem i got is that the update , insert and
delet function doesn't work if i set the ID column visiable to false.

How can i handle this case?

Cheers

Nick

Oct 5 '06 #3
Nick,

Columns and any other server controls with Visible=false don't get rendered
to client. As a result, they don't come back on postbacks and don't keep
their values. If you are interested in a hidden column value either on
client side or in postbacks, you should keep Visible=true and hide the
column with css rule display:none.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Nick" <Ni**@discussions.microsoft.comwrote in message
news:8A**********************************@microsof t.com...
HI ALL:

I have a gridview and display 4 columns , one of the column is ID , which
i
don't wanna to visible. The problem i got is that the update , insert and
delet function doesn't work if i set the ID column visiable to false.

How can i handle this case?

Cheers

Nick

Oct 5 '06 #4

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

Similar topics

4
by: Hans Merkl | last post by:
Hi, Is there a way to show the column headers of a GridView control even if there is no data? The only thing I see is the EmptyDataTemplate but I would also like to display the column headers. ...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
0
by: hammad.awan_nospam | last post by:
Hello, I am using ASP.NET 2.0. What I have done is nested a gridview inside another column of a gridview using a template data field column declaritively in my web form. Inside this child...
1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
1
by: Eric | last post by:
I have a GridView control that I want to sort on multiple columns when I click a particular column. For example, I display Last name + ", " + First name in the first column and display id in the...
4
by: bryan | last post by:
Hi all, I am working on a .net 2.0 web app. On page load I display a gridview with a drop down list (Employees), when the user selects from the drop down list, the grid view is filled with...
1
by: =?Utf-8?B?UGF0cmljayBG?= | last post by:
I have a gridview on the page that i want to dynamically populate with radiobuttons, so i went out on the net and found something that works perfectly, it created radionuttons and the postback with...
1
by: Jeff | last post by:
ASP.NET 2.0 I've got problems with the right column in my GridView. The GridView consist of 2 columns, the problem column is the column on the right side. The problem is that it looks like...
5
by: NKaufman | last post by:
<asp:GridView ID="Basic" runat="server" DataKeyNames="QuestionID,isHeading" AutoGenerateColumns="false" AllowPaging="true" PageSize="100"> <Columns> <asp:BoundField Visible="false"...
4
by: Mark Olbert | last post by:
I'm running into a well-described issue in the ASPNET model that I haven't found a good work around for. I have a GridView to which I dynamically add data-bound TemplateFields at run-time. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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:
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...
0
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,...
0
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...

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.