473,714 Members | 2,545 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 2085
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
1545
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
1177
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
1456
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
3470
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
1225
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
2415
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
7594
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
1744
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
8795
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
8701
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
9168
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...
0
9009
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...
0
7942
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6621
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
4462
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2103
bsmnconsultancy
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...

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.