473,608 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing form data

I have 3 ASP.NET forms written in C#, I also have 3 frames (left, top and bottom) one for each form. My question is if I have data on one form in the bottom frame how do I access this data when I click on the button which is on the top frame?

I want to save the data from the bottom frame to the database when a user clicks on the Update button.

Does anyone have an example on how to do this?

-----------------------------------------------------
| | Top |
| | |Update| |
| |---------------------------------------|
| | Bottom |
| Left | |
| | _Data_ _Data_ _Data_ _Data_ |
| | |
| | _Data_ _Data_ _Data_ |
| | |
-----------------------------------------------------

--
Thanks
-------------------
cz****@wsinc.co m
Nov 18 '05 #1
5 1978
Use javascript to submit the Bottom form.

window.frames['frameName'].document.body. all['Form1'].submit();

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Hi Peter,
Welcome to Microsoft Newsgroup Service. Based on your problem description,
you've a frameset which has three frames(left,rig ht top and right bottom).
There is a button in the right top frame's page and some entry fields in
the right bottom page, you want to let the datas to be saved( submit to the
serverside?) when the button in the right bottom frame is clicked?

If so , I think suggestion provided by Natty is good. You can write a
period of client javascript and when the button in the right top frame is
clicked, run the script and find the right bottom frame , then call the
form(in the right bottom frame's page) 's submit() method to post the data
to the serverside, For example:

suppose we 've a frameset page as:

<frameset id="fsleft" cols="20%,80%">
<frame name="left" src="SideMenu.a spx" scrolling="no" noresize
style="BACKGROU ND-COLOR: #ffffcc">
<frameset id="fsright" rows="16%,84%">
<frame name="rtop" src="TopMenu.as px">
<frame name="rbottom" src="MainScreen .aspx">
</frameset>
</frameset>
and in the TopMenu.aspx, there exists a button and we define a javascript
function to call the rbottom frame's page's submit() method:
.........
<script language="javas cript">
function SubmitBottomPag e()
{
window.parent.f rames['rbottom'].document.Form1 .submit();
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="500" align="center">
<tr>
<td><INPUT type="button" value="SubmitBu ttomPage"
onclick="Submit BottomPage()"></td>
</tr>
</table>
</form>
</body>

Thus, when the button "SubmitButtomPa ge" is clicked, it'll call the
"SubmitBottomPa ge()" function and in that function,
we use window.parent.f rames['rbottom'] to get the right bottom frame's page
and call it's document.Form1 element's submit method.

The MainScreen.aspx (the page in the "rbottom" frame) is like bellow:
............... ....
<body>
<form id="Form1" method="post" runat="server">
<table width="500" align="center">
<tr>
<td><FONT face="ËÎÌå">
<asp:TextBox id="TextBox1" runat="server"> </asp:TextBox></FONT></td>
<td><FONT face="ËÎÌå">
<asp:TextBox id="TextBox2" runat="server"> </asp:TextBox></FONT></td>
<td><FONT face="ËÎÌå">
<asp:TextBox id="TextBox3" runat="server"> </asp:TextBox></FONT></td>
</tr>
</table>
</form>
</body>

When the page is submited, all the data is posted to the serverside, you
can retrieve them in the page's Page_Load event.

Please try the preceding suggestion and let me know whether they help,
Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3
Thanks for your help!

This works!

One more question!
The Page_Load event fires when the page gets loaded initialy and once again
when you submit the form, is there a special flag that I can test to see if
data has been entered / changed on the form by the user or do I have to set
my own flag?

"MSFT" <v-******@online.m icrosoft.com> wrote in message
news:od******** ******@cpmsftng xa07.phx.gbl...
Hi Peter,
Welcome to Microsoft Newsgroup Service. Based on your problem description,
you've a frameset which has three frames(left,rig ht top and right bottom).
There is a button in the right top frame's page and some entry fields in
the right bottom page, you want to let the datas to be saved( submit to the serverside?) when the button in the right bottom frame is clicked?

If so , I think suggestion provided by Natty is good. You can write a
period of client javascript and when the button in the right top frame is
clicked, run the script and find the right bottom frame , then call the
form(in the right bottom frame's page) 's submit() method to post the data
to the serverside, For example:

suppose we 've a frameset page as:

<frameset id="fsleft" cols="20%,80%">
<frame name="left" src="SideMenu.a spx" scrolling="no" noresize
style="BACKGROU ND-COLOR: #ffffcc">
<frameset id="fsright" rows="16%,84%">
<frame name="rtop" src="TopMenu.as px">
<frame name="rbottom" src="MainScreen .aspx">
</frameset>
</frameset>
and in the TopMenu.aspx, there exists a button and we define a javascript
function to call the rbottom frame's page's submit() method:
........
<script language="javas cript">
function SubmitBottomPag e()
{
window.parent.f rames['rbottom'].document.Form1 .submit();
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="500" align="center">
<tr>
<td><INPUT type="button" value="SubmitBu ttomPage"
onclick="Submit BottomPage()"></td>
</tr>
</table>
</form>
</body>

Thus, when the button "SubmitButtomPa ge" is clicked, it'll call the
"SubmitBottomPa ge()" function and in that function,
we use window.parent.f rames['rbottom'] to get the right bottom frame's page and call it's document.Form1 element's submit method.

The MainScreen.aspx (the page in the "rbottom" frame) is like bellow:
............... ...
<body>
<form id="Form1" method="post" runat="server">
<table width="500" align="center">
<tr>
<td><FONT face="ËÎÌå">
<asp:TextBox id="TextBox1" runat="server"> </asp:TextBox></FONT></td>
<td><FONT face="ËÎÌå">
<asp:TextBox id="TextBox2" runat="server"> </asp:TextBox></FONT></td>
<td><FONT face="ËÎÌå">
<asp:TextBox id="TextBox3" runat="server"> </asp:TextBox></FONT></td>
</tr>
</table>
</form>
</body>

When the page is submited, all the data is posted to the serverside, you
can retrieve them in the page's Page_Load event.

Please try the preceding suggestion and let me know whether they help,
Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4
Hi Peter,
Thanks for your response. As for your question in the reply, I think you
need to add a custom flag yourself in the page which is to be submited.
Because you submit the whole page, the serverside won't know whether one of
the entry field has been modified or not. To manually add a flag, I think
you can add a hidden input area in the page(set as runat server) to perform
the flag, just like:

//default value is "no" indicate that no entry fields has been modified
<input type="hidden" name="ModifyFla g" id="ModifyFlag " runat="server"
value="no" />

and in the page , add a javascript function to modified the hidden input
area:
<script language=javasc ript>
function SetModifyFlag()
{
document.Form1. ModifyFlag.valu e = "yes"
}
</script>
Then, in other entryfield's client attributes, add a "onchange" event set
as the "SetModifyF lag" function, for example:

<input type="text" id="txtName" name="txtName" runat="server"
onchange="SetMo difyFlag()">
Since this is a client script, when the textbox's value is changed ,the
"ModifyFlag " hidden area's value'll be set as "yes"
#note that you'd better use <input type="text" runat="server"/> rather than
the <asp:textbox> because the html serveside control is easier to set its
client attributes than the ASP.NET webcontrol.

Thus in the serveside code, you can check the value to know whether any
entryfield has been modified:

private void Page_Load(objec t sender, System.EventArg s e)
{
if(ModifyFlag.V alue.Equals("ye s")
{
//do operations..... .....
}

}
Please try the preceding suggestion and let me know whether they help,
Thanks.

Merry Christmas!!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #5
Thank you for your help!

I think this is what I need!

"Steven Cheng[MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:7b******** ******@cpmsftng xa07.phx.gbl...
Hi Peter,
Thanks for your response. As for your question in the reply, I think you
need to add a custom flag yourself in the page which is to be submited.
Because you submit the whole page, the serverside won't know whether one of the entry field has been modified or not. To manually add a flag, I think
you can add a hidden input area in the page(set as runat server) to perform the flag, just like:

//default value is "no" indicate that no entry fields has been modified
<input type="hidden" name="ModifyFla g" id="ModifyFlag " runat="server"
value="no" />

and in the page , add a javascript function to modified the hidden input
area:
<script language=javasc ript>
function SetModifyFlag()
{
document.Form1. ModifyFlag.valu e = "yes"
}
</script>
Then, in other entryfield's client attributes, add a "onchange" event set
as the "SetModifyF lag" function, for example:

<input type="text" id="txtName" name="txtName" runat="server"
onchange="SetMo difyFlag()">
Since this is a client script, when the textbox's value is changed ,the
"ModifyFlag " hidden area's value'll be set as "yes"
#note that you'd better use <input type="text" runat="server"/> rather than the <asp:textbox> because the html serveside control is easier to set its
client attributes than the ASP.NET webcontrol.

Thus in the serveside code, you can check the value to know whether any
entryfield has been modified:

private void Page_Load(objec t sender, System.EventArg s e)
{
if(ModifyFlag.V alue.Equals("ye s")
{
//do operations..... .....
}

}
Please try the preceding suggestion and let me know whether they help,
Thanks.

Merry Christmas!!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6

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

Similar topics

1
2943
by: JC | last post by:
How do I extract data from a form into the main form for processing? For instance, I have several image files in a form called images(images.frm), indexed from 0 to 99, and I want to import these into a variable array in my main form, main (form1.frm). How do I code a control to get these images into an array in my main form from the images.frm? TIA
5
2437
by: Craig Anderson | last post by:
Can anyone tell me the best way to access a hidden object in a form? I could use a hard-coded index to the elements of the form, but it's too easy to add something before the hidden object and mess up the indexing. For example: The form has a tagid of "myForm" The hidden object has a tagId of "myHiddenObj"
1
1519
by: Esben Rune Hansen | last post by:
Hi I am working on a PHP-script and need javascript to set the value of a hidden field in a form. This field happens to be an entry in an array data according to my example. How can I do this? Below is listet two PHP-pages: one that doesn't work (to my dismay), and another that does work, but do not use an array entry in the hidden field. Thanks
6
2735
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is called "form1", and I have selects called "PORTA", "PORTB" ... etc...
2
4350
by: Barry Schwarz | last post by:
Given a union of the form union { T1 m1; T2 m2;}obj; where T1 and T2 are different scalar (non-aggregate) types. The C99 standard states that obj.m1 = value; if (obj.m2 ... invokes undefined behavior because my reference to the union is via a
1
1379
by: spalding | last post by:
Hi I have a situation in which I need to find out how much data has bee posted during a form's POST method. The amount of data I am posting is large (the form includes a fil input) and I wish to retrieve the size of the form's data as it i POSTED. I have tried accessing this using the HTTPRequest object's InputStream
0
12069
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the likelihood of CRM success from less than 20 percent to 60 percent. WHITEPAPER :
4
3614
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if possible.. for example..i hav a menu in the parent form named "Administrator" whic has an item "mnuLogIn"..now when i click on login..another child form named "frmLogIn" is displayed..what i want to happen is this: when login form(frmLogIn) is...
4
4212
by: Noy B | last post by:
Hi, I have developed a small application that is using a MSAccess DB. the problem is that it was developed on a machine where the application and the DB are both located. now it needs to be change that the application will be able to run on any other machine (using \\ syntax on the run command- not a problem) using the DB located on a static-different machine. for this purpose I need to create a Remote Connection from my
4
2682
by: nottarealaddress | last post by:
I'm trying to get my feet wet in VB2005 (our new standard at work after officially stopping new development in VB6 about a month ago). I'm working with a simple sql 2005 table of 50 entries, one for each state. Each entry contains Name, postal abbreviation, etc. Just simple stuff to understand the mechanisms, syntax, etc. I'm now to the point where I've got a Master MDI form that opens one or more types of forms, I'm able to edit/save...
0
8067
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
8483
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
8157
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
8349
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
6820
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
6015
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
4030
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2477
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
0
1336
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.