473,652 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clicked Cell still appear after I leave and re-enter the form? --C#

19 New Member
Hi, everyone.
I got a weird problem for my C# program. In my program, I use a DataGrid to display data. I bind the DataGrid to a DataTable. I made all the cells in DataGrid ReadOnly as True. So I can only Click on the cell but not change them.

Now, after I display the data, I clicked on one cell, then I clicked a button which will *virtually* go to the other form.(The reason why I said *virtually* is because I only use one form for the whole program. Every time I hit a button, according to the Caption shown on the button, i will hide some content in the form, and display some contents. So it looks like we are going to different forms, but actually we only got one form in total).

Back to the problem, After I *virtually* exit the data display form, I click a button to re-enter to data display form which will request me to type username and password to show the data. Before I entered username and password, the DataGrid area should appear purely blank, just as first time coming in. But what I actually got is the cell i clicked before appeared in the DataGrid area, and only that cell!

I tried to use DataGrid.DataSo urce = Null to clear the DataGrid, but it didn't work. I even tried to do ((DataTable)Dat aGrid.DataSourc e).Clear() before I dereference the DataSource from DataGrid, it still didn't work. Anyone got an idea of it?




PS: Sorry for my long post, and since i couldn't figure out which part got wrong, so i couldn't post the code coz it's too long.
Dec 22 '06 #1
2 2083
karthi84
271 Contributor
try with this code for clearing the datagrid if not i will try for a new solution for you
Expand|Select|Wrap|Line Numbers
  1. DataGrid1.DataSource="";
  2. DataGrid1.DataBind();
  3.  
Dec 28 '06 #2
kenobewan
4,871 Recognized Expert Specialist
My suggestion is that you bind the data to the datagrid in page load, but set the datagrid view to false. Once you have dealt with the username & password, you can set the datagrid visibility to true. You may display a message to this affect to the user.

Hope that this helps.
Dec 28 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1542
by: Paul Daly (MCP) | last post by:
How do you access the value of a cell in a Windows form datagrid? I know this is how you would do it using an ASP.NET datagrid: DataGrid1.Items.Cells.Text However, "Items" is not available in the Windows Forms datagrid. Thanks, Paul
1
1176
by: ilPostino | last post by:
Hi, I want to create a control that when dragged from the Toolbar onto a form doesn't appear on the form but instead appears in that magical area below the form. Something similar to a Timer control. Any ideas? Is it possible to create these controls for normal .cs files? (No Designer) The reason I ask is I want to create a control that manipulates any file in the project once dragged onto that file or even the project. Thanks
4
1446
by: Dot net work | last post by:
If I have got 2 web user controls on my aspx form, and one web user control has got some validator controls on it, what I find is that if I enter in some "bad data" in to some text boxes on the first web user control, then click on a link button on the second web user control to leave the aspx form, it won't let me - the validators run on the first web user control and highlight the errors and won't let me leave until I fix them. I'm...
10
3462
by: Mr Newbie | last post by:
DropDown lists and Listboxes do not appear in the list of controls and values passed back to the server on PostBack in Request.Form object. Can someone confirm this to be correct and possibly answer why ? The impact of this is that values added via javascript will never make it back to the server side code unless one does some jiggery pokery with hidden fields etc. If this is true, then I would like to understand the reason behind the...
4
1222
by: SStory | last post by:
I want to use F6,F7,etc for an entire form. Have key preview to true and it works everywhere but on the grid. On the grid sometimes it works and sometimes not. Appears that if I am in a cell and press one of them it won't work. Any ideas? Shane
2
1545
by: Nick Douglas | last post by:
We want our company logo to appear on the forms in our database. The logo is on our homepage. Is there a way to link it? (rather than embed it).
4
2412
by: Hmunawar | last post by:
I m using a data gridveiw control in Window forms application and i want to delete the record on which the user clicks, for this purpose i need to get the index of the clicked row. How can i get these......... Kindly tell me if anybody has a solution.........
5
7588
by: ramprat | last post by:
Hi, Using Access 2003 how do you read the value from a particular cell (row/column combination) in the current record of a continuous form and use this value elsewhere? For example, how do you capture what is in column 2 of the current record of a continuous form? This sounds like it should be simple but maybe I am. Thanks
3
1743
by: John Dale | last post by:
This is the form that I created. http://postimg.org/image/pe3abqek3/ Specifically, I've got problems on updating the current date, adding specified values on fields(vacation, sick, vs_total) and summing up the values to total. http://postimg.org/image/pp5v01obt/ I have finally finished the fill-up form of the Leave Application. Now, what I have to do is that every end of the month, employees would be given a privileged day of 1.25 on...
0
8370
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
8811
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
8704
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
8470
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
8590
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
6160
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
5620
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();...
1
2707
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
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.