473,657 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid Questions

Hi,

In C#
i) Is there anyway to input value on particular cell in datagrid in the
coding?
ii) How do I save the contents of the datagrid back to database?
iii) I've made a custom datagrid myself, with button on column. However,
what I really want is actually a textbox with button in one column. Is there
any example regarding that?

Pls advise.
Thanks in advance.
pcPirate.
Nov 15 '05 #1
1 1218
Hi,
i) Is there anyway to input value on particular cell in datagrid in the
coding?
You should update the corresponding value in the bound data source instead.
The grid will notice the change and re-paint the cell.
ii) How do I save the contents of the datagrid back to database?
If your data source is a DataTable or a DataSet, you could query it for
GetChanges() and then feed the result of this call to the DataAdapter.
iii) I've made a custom datagrid myself, with button on column. However, what I really want is actually a textbox with button in one column. Is there any example regarding that?
If you know how to host a button within a column, you know how to host any
user control within a column. Create a custom user control containing the
textbox and the button and host it instead the button.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"pcPirate" <ph****@hotmail .com> wrote in message
news:uX******** ******@TK2MSFTN GP11.phx.gbl... Hi,

In C#
i) Is there anyway to input value on particular cell in datagrid in the
coding?
ii) How do I save the contents of the datagrid back to database?
iii) I've made a custom datagrid myself, with button on column. However, what I really want is actually a textbox with button in one column. Is there any example regarding that?

Pls advise.
Thanks in advance.
pcPirate.


Nov 15 '05 #2

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

Similar topics

3
3355
by: Dmitry Akselrod | last post by:
Hi, I am using a standard .NET 1.0 Datagrid. Actually, I am using two, bound to a master-detail relationship. Both DataGrids are bound to a datasource. I have the MSDN version of the DateTime picker functioning quite well in the datagrid. I am also tracking a double-click event within another column in the datagrid. The column is just text. When the double-click event trigger fires, I load a borderless form, from which a user...
0
1140
by: Phil Townsend | last post by:
I am building an online testing application that uses a usercontrol to navigate through a list of questions. The questions are multiple choice. I have a stored procedure that returns two tables: questions & answers. I have defined a relationship in code using a DataRelation. I would like to use a datagrid to display the questions and answers in order to take advantage of paging offered with the datagrid. Where I am having difficulty is...
7
4670
by: Matthew Wieder | last post by:
Hi - I have a datagrid that has a black header and the rows alternate white and gray. The problem is that until items are added to the grid, the grid appears as a large black rectangle, which is quite ugly. The black area is larger then it is once an item is added. How can I solve this problem either by: A) Having only the header black and the rest of the empty block white or gray (preffered solution) B) Having the color gray or white...
5
1470
by: VB Programmer | last post by:
I have an ASP.NET form that allows people to answer survey questions. There could be from 5 to an unlimited amt of questions, depending on which questions the admin wants to users to answer (he sets it up previously). The questions are in a db. Is a datagrid the best way to display this data? What do you suggest? After they enter the info I want to be able to save it back to the db. Any helpful links/examples?
10
4941
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...
2
1437
by: Maarten | last post by:
Hi all, I have a datagrid with questions where the user has to make a choice (yes or no questions) But for some questions there are rules, like if you choose (yes or no) for some questions I need to skip 1 or more questions. e.g. Q1. Do you..... Y | N Q2. Do you..... Y | N
9
2117
by: Tony Girgenti | last post by:
Hello. I'm developing and testing a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 computer. I'm using a web form. For a datagrid control, i used the Caption property. It displays fine on the datagrid and allows me to run the program. But, when i view the HTML for the web form, it shows this error at the
9
2714
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the code: <script runat="server"> Dim sqlConn As New SqlConnection(".....") Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If Not (Page.IsPostBack) Then FillDataGrid()
1
2152
by: RN1 | last post by:
Consider the following DataGrid: -------------------------------------------------------------------------------- <asp:DataGrid ID="dgMarks" AutoGenerateColumns="false" runat="server"> <Columns> <asp:TemplateColumn> <HeaderTemplate> <asp:CheckBox ID="chkHeader" OnCheckedChanged="CheckUncheckAllRows" AutoPostBack="true" runat="server"/> </HeaderTemplate>
2
6582
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
8827
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
8732
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
8503
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
8605
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
7333
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
6167
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
5632
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
2731
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
2
1957
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.