473,795 Members | 3,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add a Column to Grid Upon Clicking on OK Button

Hi All,

This seems to be a difficult problem for me. Hope you can help me
out...

I have a program whose major part is a grid that displays several
columns from data obtained from a stored procedure. There is a dialog,
and if the user clicks on the "OK" button, an extra column should be
appended to the grid. BTW, a separate stored procedure is used to get
data including this extra column.

Now I have both stored procedures ready. However, the difficult part is
that I don't know where to add C# code to add the extra column, or to
use the second stored procedure containing the extra column. I also
don't know what other changes to make in order for it to work.

The "btnOK_Clic k" method is not defined in the class for the dialog.
Instead it's defined in its base class from which the dialog is
derived. To give you more details, the methods is as follows:

private void btnOK_Click(obj ect sender, System.EventArg s e)
{

foreach(string lValue in mFilters.Keys)
{
this.CaptureVal ue(lValue,this[lValue]);
}

this.ThisBindin gContext.SaveSe ttings();
}

Anyone can tell me what I need to do in order to get an extra column
added to the grid upon clicking on the "OK" button?

Many thanks!
-Emily

Jul 19 '06 #1
1 1292
Not sure if it would work ok with what you are doing, but could you not
return an extra column from your stored procedure sot hat the grid is all set
up correctly before and then simply hide the column until the user presses
the button?
--
Thanks!
"Fir5tSight " wrote:
Hi All,

This seems to be a difficult problem for me. Hope you can help me
out...

I have a program whose major part is a grid that displays several
columns from data obtained from a stored procedure. There is a dialog,
and if the user clicks on the "OK" button, an extra column should be
appended to the grid. BTW, a separate stored procedure is used to get
data including this extra column.

Now I have both stored procedures ready. However, the difficult part is
that I don't know where to add C# code to add the extra column, or to
use the second stored procedure containing the extra column. I also
don't know what other changes to make in order for it to work.

The "btnOK_Clic k" method is not defined in the class for the dialog.
Instead it's defined in its base class from which the dialog is
derived. To give you more details, the methods is as follows:

private void btnOK_Click(obj ect sender, System.EventArg s e)
{

foreach(string lValue in mFilters.Keys)
{
this.CaptureVal ue(lValue,this[lValue]);
}

this.ThisBindin gContext.SaveSe ttings();
}

Anyone can tell me what I need to do in order to get an extra column
added to the grid upon clicking on the "OK" button?

Many thanks!
-Emily

Jul 20 '06 #2

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

Similar topics

2
2355
by: Raj | last post by:
Hi, When we are sorting the DataGrid Boolean column the grid is becoming redcross. I have my own PPMIPDataGridBoolColumn class inherited from System.Windows.Forms.DataGridBoolColumn. In this inherited class I have one DataGridValueChangedEventHandler event handler. I am overriding Edit() to know the current state of the cell. I am overriding Paint() to know the if the user has been editing the cell. I am also overriding the Commit() to
0
1129
by: Sathyaish | last post by:
I want to display a column in a datagrid such that each item/row in that column acts as a hyperlink. Further, when I click on the hyperlink, it doesn't redirect to another page or even to itself. Rather it "POSTS" pack to itself, and fetches the values in the entire row into the textboxes displayed on the same page outside of the data grid. >From my understanding of this, I believe I have two courses I could follow.
0
1407
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi all, I have a column that the user is only allowed to edit if s/he added the row. I set read-only = true for this column when I load the grid. I allow the user to add a row by clicking a button - for which I .AddNew to the bindingsource that I used as the datasource for the grid. I use .AddNew on the bindingsource so that I can control the number of new rows the user can add (based upon whether s/he filled in all mandatory values...
2
7615
by: rameshgohil | last post by:
I am using grid view and a button column in it using <itemTemplate> but I am not able to rerive cell value of a selected row from grid view. I have tried the following to methods in Row_command event of gridview but it gives Null reference exception error while clicking the button in button column of grid view : int index = gdvOdetails.SelectedIndex; object oid = (object)gdvOdetails.SelectedDataKey.Values; txtMsg.Text =...
0
9672
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
9519
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
10437
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
10214
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
10001
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
6780
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
5437
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...
1
4113
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
3723
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.