473,661 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

To get number on the textbox according to the no. of columns in the datagrid.

111 New Member
hii all,

i have two forms,


worker search form and childsearch form..


in worker search form, i have a button.. search child and textbox... number of children

if i click that, it will direct to child details form.....

in that i have datagrid.... the number of children are displayed ...

now the number of children present should be displayed in the number of children text box on worker search form....


can anyone plz tell me... how to get that..???

its very urgent...

plz help..

thnx...

hepsi..
Jul 27 '07 #1
5 1352
nateraaaa
663 Recognized Expert Contributor
hii all,

i have two forms,


worker search form and childsearch form..


in worker search form, i have a button.. search child and textbox... number of children

if i click that, it will direct to child details form.....

in that i have datagrid.... the number of children are displayed ...

now the number of children present should be displayed in the number of children text box on worker search form....


can anyone plz tell me... how to get that..???

its very urgent...

plz help..

thnx...

hepsi..
This sounds like you want to do a count on the number of rows returned to your datagrid. Do a datagrid.Items. Count on your datagrid. This should give you the number of rows returned. Save this value in a session variable. Then in the page load of your worker page assign the value of the textbox to the value of the session variable.

Make sure that in the page load of your worker page you check to see if the session variable is null before assigning the value to the textbox. If it is null then you will know that datagrid has not returned any results yet.

Nathan
Jul 27 '07 #2
rhepsi
111 New Member
This sounds like you want to do a count on the number of rows returned to your datagrid. Do a datagrid.Items. Count on your datagrid. This should give you the number of rows returned. Save this value in a session variable. Then in the page load of your worker page assign the value of the textbox to the value of the session variable.

Make sure that in the page load of your worker page you check to see if the session variable is null before assigning the value to the textbox. If it is null then you will know that datagrid has not returned any results yet.

Nathan
thnx...

can u plz tell me how to declare a session.... and moreover im using vb.net windows application..?

i want somthing like, when i click close button in the search child form...,

i should able to get the row count of datagrid to the textbox of worker search from..

plz help....

thnx..
hepsi..
Jul 30 '07 #3
RoninZA
78 New Member
The best way would be to declare a public property in your child form, which you can then access from the calling parent form.

in C# it would look something like this:-

child form:
Expand|Select|Wrap|Line Numbers
  1. private System.Data.DataSet searchResults = new System.Data.DataSet();
  2.  
  3. public System.Data.DataSet SearchResults
  4. {
  5.     get { return searchResults; }
  6.     set { searchResults = value; }
  7. }
  8.  
  9. protected void btnSearch_Click(object sender, EventArgs e)
  10. {
  11.     //Do your search code, populating the searchResults DataSet
  12.     .
  13.     .
  14.     searchResults = <Your search results object>;
  15.     this.Hide();
  16. }
  17.  
Then in the parent form:
Expand|Select|Wrap|Line Numbers
  1. protected void btnSearch_Click(object sender, EventArgs e)
  2. {
  3.     frmSearchChild frm = new frmSearchChild();
  4.     frm.ShowDialog();
  5.     txtNumberOfRows.Text = frm.SearchResults.Tables[0].Rows.Count.ToString();
  6.     frm.Close();
  7. }
  8.  
Hope it helps!
Jul 30 '07 #4
rhepsi
111 New Member
The best way would be to declare a public property in your child form, which you can then access from the calling parent form.

in C# it would look something like this:-

child form:
Expand|Select|Wrap|Line Numbers
  1. private System.Data.DataSet searchResults = new System.Data.DataSet();
  2.  
  3. public System.Data.DataSet SearchResults
  4. {
  5.     get { return searchResults; }
  6.     set { searchResults = value; }
  7. }
  8.  
  9. protected void btnSearch_Click(object sender, EventArgs e)
  10. {
  11.     //Do your search code, populating the searchResults DataSet
  12.     .
  13.     .
  14.     searchResults = <Your search results object>;
  15.     this.Hide();
  16. }
  17.  
Then in the parent form:
Expand|Select|Wrap|Line Numbers
  1. protected void btnSearch_Click(object sender, EventArgs e)
  2. {
  3.     frmSearchChild frm = new frmSearchChild();
  4.     frm.ShowDialog();
  5.     txtNumberOfRows.Text = frm.SearchResults.Tables[0].Rows.Count.ToString();
  6.     frm.Close();
  7. }
  8.  
Hope it helps!


thnx...

hey can u plz tell me the code clearly in child form....

plz help..
its really very urgent,,,

thnx..
hepsi
Jul 30 '07 #5
RoninZA
78 New Member
That I can't do - I have no idea how you're search works!!!! Remember that I used a DataSet as an example, you can make your searchResults property return any object type...
Jul 30 '07 #6

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

Similar topics

0
2794
by: Andrea Trevisan | last post by:
That's a revival of a known thing I suppose.I hope it's useful. My problem was: I want to have a DataGrid with two Template columns: first with TextBox,second with Button.I want to fire an event from button and I want to have a reference to TextBox to make use of it.The most difficult was the reference to TextBox. This sample is taken from MCAD/MCSD Exam 70-305/70-315 of Microsoft Press.This book is much more exhaustive than the brief...
1
15738
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template columns to show some of the columns. Few of the columns have textboxes to make them available for editing. I am trying to update the dataset all at once using one update button. Here is my code... (for simplicity I have only listed one of the...
2
2483
by: Martin Hazell | last post by:
For various reasons, I have had to produce a quick (!) page to edit one column of data in a database with ASP.net. With this being my first foray into ASP.net, I apoligise for any basic erros I have made. The main problem is when setting up an ASP.net datagrid, which I can edit the single value of a specific column. I have wired up the update and edit methods to change the current edit row. I worked through the example in the MSDN help to...
1
1863
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template columns to show some of the columns. Few of the columns have textboxes to make them available for editing. I am trying to update the dataset all at once using one update button. Here is my code... (for simplicity I have only listed one of the...
2
5372
by: Maziar Aflatoun | last post by:
Hi everyone, I have this DataGrid that I bind to a DataTable. However, instead of displaying the column 'Qty', I like to place it in a textbox and display the value of Qty as the default value for the TextBox. Any suggestions? <asp:datagrid id="DGShoppingCart" runat="server" Width="650" AutoGenerateColumns="False"> <Columns> <asp:BoundColumn DataField="ProductName" HeaderText="Product"
8
3473
by: tshad | last post by:
I cannot seem to get the asp:textbox to use classes. Style works fine. I am trying to set the textbox to act like a label in some instance so it doesn't have a border, readonly and the background is grey. I have a class set as: ..table2Label{ border-style:none; background-color:#F6F6F6; }
0
1382
by: John Shum | last post by:
I prepare a UserControl that act as a lookup control, once the code is enter in the TextBox, the description will appear in another TextBox outside the UserControl of the same row in a DataGrid via javascript. I attempt to get the client ID of the TextBox (with provided ID of that TextBox as "ext_desc") by the following code inside the Page_Load() event of the UserControl (named Color_Control): for(int i = 0; i < DataGrid1.Items.Count;...
2
2974
by: ismaelf | last post by:
i have a textbox in a template column in a datagrid, it displays the initial value of the row, but when i change it remains with the original value (it doesnt get the new value..) i fill the CartTable programmatically with rows from a database binded datagrid.. i cant figure out what is wroooong! hehe thanks for helping here is my code: TABLE CODE (in the page_load): If Session("shop_cart") Is Nothing Then
3
3724
by: rn5a | last post by:
A DataGrid has a BoundColumn, an EditCommandColumn & a few TemplateColumns. When the text in the EditCommandColumn within any of the DataGridItems is clicked, the corresponding BoundColumn changes to a TextBox. How do I get the ID of such a TextBox?
0
8432
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
8343
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
8855
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
8758
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
8545
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
7364
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
6185
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...
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1743
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.