on my web form I have a checkbox for the user to check or not. How can I pass
the value of the checkbox to my business layer to execute the correct SQL
statement?
I need to run seperate sql queries based on if the checkbox is checked on my
web form or not. So is it possible to pass the checkbox value to my datalayer
class? 9 919
"CsharpGuy" <Cs*******@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com... on my web form I have a checkbox for the user to check or not. How can I pass the value of the checkbox to my business layer to execute the correct SQL statement? I need to run seperate sql queries based on if the checkbox is checked on my web form or not. So is it possible to pass the checkbox value to my datalayer class?
I'm not exactly certain what your problem is... An <asp:CheckBox> control
has a boolean Checked property - interrogate that when the page is posted
back, and branch your code accordingly.
do something like the following
public void GetChecked(bool isChecked)
{
if (isChecked == true)
// do code for checked
else
// do code for unchecked
}
then, you call the following
GetChecked(CheckBox.Checked);
HTH,
Darren Kopp http://blog.secudocs.com/
I know how to get the value, but its not passing to my datalayer.
i have this on my form
if (chkBox.checked == true)
{
callDataLayer();
}
then in my datalayer I need to get that value and "trap it" and run the
correct SQL query in a method in my datalayer
"Mark Rae" wrote: "CsharpGuy" <Cs*******@discussions.microsoft.com> wrote in message news:0B**********************************@microsof t.com... on my web form I have a checkbox for the user to check or not. How can I pass the value of the checkbox to my business layer to execute the correct SQL statement? I need to run seperate sql queries based on if the checkbox is checked on my web form or not. So is it possible to pass the checkbox value to my datalayer class?
I'm not exactly certain what your problem is... An <asp:CheckBox> control has a boolean Checked property - interrogate that when the page is posted back, and branch your code accordingly.
callDataLayer(chkBox.checked);
???
what are you returning? you would want something like this
[public|protected|private] [datatype] callDataLayer(bool isChecked)
{
// logic to perform
}
from what you had, it looks like it would be a void, so something like
this would work
public void callDataLayer(bool isChecked)
{
// code
}
then you would call the method with what you had, although in c#
Checked needs to be caps, for
callDataLayer(chkBox.Checked);
HTH,
Darren Kopp http://blog.secudocs.com/
what are you returning? you would want something like this
[public|protected|private] [datatype] callDataLayer(bool isChecked)
{
// logic to perform
}
from what you had, it looks like it would be a void, so something like
this would work
public void callDataLayer(bool isChecked)
{
// code
}
then you would call the method with what you had, although in c#
Checked needs to be caps, for
callDataLayer(chkBox.Checked);
HTH,
Darren Kopp http://blog.secudocs.com/
should the GetChecked be in the datalayer or no?
Thats where I'm stuck at because i have a method in the dl that will run 1
of 2 queries based on the checkbox value
so how would the dl get that value of the checkbox?
"Darren Kopp" wrote: do something like the following
public void GetChecked(bool isChecked) { if (isChecked == true) // do code for checked else // do code for unchecked }
then, you call the following
GetChecked(CheckBox.Checked);
HTH, Darren Kopp http://blog.secudocs.com/
I would have that in the datalayer, yes. Basically, you pass the value
of the checkbox through the Checked property. The checked property
gets or sets a boolean value, so when you pass it, it passes a boolean
value, which your data layer is expecting. It doesn't see it as a
checkbox or checked, it sees it as true or false. in your data layer,
you say
if (isChecked == true)
// generate 1 sql statement
else
// generate a different sql statement
-Darren Kopp http://blog.secudocs.com/
"CsharpGuy" <Cs*******@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com... I know how to get the value, but its not passing to my datalayer.
i have this on my form if (chkBox.checked == true) { callDataLayer(); }
then in my datalayer I need to get that value and "trap it" and run the correct SQL query in a method in my datalayer
??? So pass it into your callDataLayer() method as an argument, e.g.
callDataLayer(chkBox.checked);
Then modify the callDataLayer function to accept a boolean parameter e.g.
public void callDataLayer(bool bChecked)
{
if(bChecked)
{
// do something
}
else
{
// do something else
}
}
I still don't really see what your problem is... Pass the value of your
checkbox into your datalayer and then take action as appropriate... This
really nothing to do with ASP.NET per se - it's just basic programming...
??? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: itsharkopath |
last post by:
Hi,
Imagine a user in a hotspot, when he comes to the hotspot and tries
to load a webpage (on the internet), he would automatically redirected
to login page.
I believe the following is to be...
|
by: Steven T. Hatton |
last post by:
This was written for the gnu.g++.help list. It rather clearly spells out the
most important feature of Java that I believe C++ lacks. I really don't
believe the C++ Standard sepcifies enough for a...
|
by: jaialai technology |
last post by:
I want to reload a url in a browser window so I do something like this:
open(window.location.href= "www.yahoo.com");
ok, so now I want to do something when that page is done loading
completely....
|
by: Morten Overgaard |
last post by:
Hi
I have a C# component which fires events. I want to catch these events in my
MFC app compiled with the /clr.
I know I can define a managed class in my MFC app which traps the events -
but I...
|
by: Sharon |
last post by:
I'm writing a new control derived from UserControl.
I need to get an event when the control is done resizing.
I tried the Resize, SizeChanged, Move and the Layout events and I also tried
to...
| |
by: Miguel Dias Moura |
last post by:
Hi,
When I subscribe a web site I usually receive an email to confirm my
subscription. Only after I follow the link in the email my account gets
activated.
In general, how is this done? Can...
|
by: BrianDH |
last post by:
Group
Early this week I ask for examples on how to call a VB.NET Web Service and
access its DataSet for a traditional ASP page.
I was told, "you can't", "won't work", "not possible".
Well I...
|
by: Ark |
last post by:
Hello NG,
I arrange data in structs like
{
members...
uint16_t crc;
more members, maybe...
}
Then I need to save them, up to and including crc, in non-volatile
memory or a file, as the case...
|
by: maya |
last post by:
http://news.yahoo.com/news?tmpl=index2&cid=703
down the page, under "More Stories", there's a section with two
interchangeable divs which slide back and forth into view.. how is this
done?
I...
|
by: poolboi |
last post by:
hey guys,
i've done most of my web app. for searching almost done
but then i got a small little problem with logging in
i need to know how session tracking is done in perl
if not my log in page...
|
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,...
| |
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |