473,802 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting asp:parameter at runtime - possible?

Hi guys

I have the following AccessDataSourc e control on my page..

<asp:AccessData Source ID="adsAllStori es" runat="server"
DataFile="~/App_Data/Stories.mdb"
SelectCommand=" SELECT StoryID, StoryTitle FROM Stories WHERE
StoryTitle LIKE '?%' ORDER BY StoryID DESC">
<SelectParamete rs>
<asp:Paramete r Type="char" DefaultValue="A " Name="AllParam" />
</SelectParameter s>
</asp:AccessDataS ource>

I also have a code generate A-Z link list, which when clicked reload the
page with the querystring ?id= <whichever letter I click>

I'm trying to change the value of the AllParam property on the datasource
when we read the querystring, but i can only find DefaultValue as a property,
and when I watch it, it says that "DefaultVal ue does not exist in the current
context".

The code I'm using in Page_PreRender is...

adsAllStories.S electParameters["AllParam"].DefaultValue = showChar; // a char

I'm not using a querystringpara meter because I'm performing other functions
on showChar before I pass it to the SelectParameter s.

But.. how can I pass it to the accessDataSourc e?!?!

Thanks,

Dan

Feb 26 '07 #1
5 8330
I also have a code generate A-Z link list, which when clicked reload the
page with the querystring ?id= <whichever letter I click>
But.. how can I pass it to the accessDataSourc e?!?!
Why don't you add a "QueryStringPar amter"?

<SelectParamete rs>
<asp:SelectPara meter name='SQL_Query _Parameter_Name '
QueryStringFiel d='Query_String _Parameter_Name ' />
</SelectParameter s>
For your case:
<SelectParamete rs>
<asp:SelectPara meter name='AllParam' QueryStringFiel d='id' />
</SelectParameter s>
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Feb 26 '07 #2
Gaurav,

I want to do something to the querystring before it's passed into the
accessdatasourc e. This is why I haven't used to <querystringopt ion.

"MasterGaur av (www.edujini-labs.com)" wrote:
I also have a code generate A-Z link list, which when clicked reload the
page with the querystring ?id= <whichever letter I click>
But.. how can I pass it to the accessDataSourc e?!?!

Why don't you add a "QueryStringPar amter"?

<SelectParamete rs>
<asp:SelectPara meter name='SQL_Query _Parameter_Name '
QueryStringFiel d='Query_String _Parameter_Name ' />
</SelectParameter s>
For your case:
<SelectParamete rs>
<asp:SelectPara meter name='AllParam' QueryStringFiel d='id' />
</SelectParameter s>
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Feb 26 '07 #3
Howdy,

Handle AccessDataSourc e.Selecting event.
BTW I'm quessing there is an error in the query:
LIKE '?%' ORDER BY StoryID DESC
should be
LIKE ? & '%' ORDER BY StoryID DESC

Hope this helps
--
Milosz
"musosdev" wrote:
Gaurav,

I want to do something to the querystring before it's passed into the
accessdatasourc e. This is why I haven't used to <querystringopt ion.

"MasterGaur av (www.edujini-labs.com)" wrote:
I also have a code generate A-Z link list, which when clicked reload the
page with the querystring ?id= <whichever letter I click>
>
But.. how can I pass it to the accessDataSourc e?!?!
Why don't you add a "QueryStringPar amter"?

<SelectParamete rs>
<asp:SelectPara meter name='SQL_Query _Parameter_Name '
QueryStringFiel d='Query_String _Parameter_Name ' />
</SelectParameter s>
For your case:
<SelectParamete rs>
<asp:SelectPara meter name='AllParam' QueryStringFiel d='id' />
</SelectParameter s>
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------

Feb 26 '07 #4
Hi Dan,

The AccessDataSourc e.SelectParamet ers are used to define parameters. To
change the parameter value at run-time, you need to do this in the
Selecting event and use the Command.Paramet ers collection:

protected void AccessDataSourc e1_Selecting(ob ject sender,
SqlDataSourceSe lectingEventArg s e)
{
e.Command.Param eters["AllParam"].Value = ...;
}

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 27 '07 #5
Thank you both!

"Walter Wang [MSFT]" wrote:
Hi Dan,

The AccessDataSourc e.SelectParamet ers are used to define parameters. To
change the parameter value at run-time, you need to do this in the
Selecting event and use the Command.Paramet ers collection:

protected void AccessDataSourc e1_Selecting(ob ject sender,
SqlDataSourceSe lectingEventArg s e)
{
e.Command.Param eters["AllParam"].Value = ...;
}

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 27 '07 #6

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

Similar topics

0
1455
by: matt | last post by:
Hi There we have a new asp.net site that is getting a lot of hits. I have set this up on its own server with its own database server. We have a search system built into the site which is timing out (there are thousands of pages to full text search) I have got several of the following event logs which may be attributed to doing a search which times out EVENT ID 1090 SOURCE: ASP.NET 1.1.4322. Failed to execute request because...
2
2259
by: J Krugman | last post by:
I have a form with a couple of submit buttons, plus a "pseudolink" that is also supposed to submit the form; the submitted form data feeds to a CGI script. The two submit buttons have the name "go_for_it", so that when the form is submitted, the CGI script looks for the value of the CGI parameter "go_for_it". I want the pseudolink to set the value of this CGI parameter prior to submitting the form, but I can't get it to work. Here's the...
3
2408
by: Torsten Bronger | last post by:
Hallöchen! I have to generate excerpts in different human languages in a program. In general, the language is not the locale's language, but set at runtime. Nevertheless, GNU's gettext should be used for the excerpts. This means that I have to wrap calls to gettext() in a function that sets the locale temporarily. The problem is how to do that. Let's assume I need to generate German snippets. Then I could say
8
2016
by: Rick Strahl [MVP] | last post by:
Hi all, I'm building an app that uses the ASP.Net runtime... One problem I've run into is that pages running inside of the runtime are not finding DLLs in the GAC. In fact, if I look at the debug trace of the search path it searches the bin directory and Temporary ASP files but not the GAC. A simple example I used was trying to load System.Windows.Forms. If I add a
6
539
by: mark | last post by:
I have an asp.net ecommerce web application on a remote web server. I'm using an Access database on the back end. I've notice a few strange things. When I mimic an multiple user environment by surfin it in multiple browsers simultaneously the site generates a generic runtime error after awhile. I'm thinking this has something to do with my access database and multiple connections. I'm using forms authentication with a login page. Is...
1
999
by: abcd | last post by:
How do I determine that ASP.NET runtime 1.1 is installed on the machine?
3
1318
by: Newbie | last post by:
Hi, For my recent web project, I need to built a site which has 3 language. The content pages are identical, so it only the language that differ. What I planned is: I'll build a masterpage for each language, and fill up the content from the database, based on selected language. My question is: is it possible to determine what masterpage to use at runtime, that is based on visitors choice of language. Or, are there any other...
12
10851
by: karanj | last post by:
Hi all, I'm facing an issue with Access that I haven't been able to find a solution for, despite hours of googling, so I hope someone here can help! I've got a report - rptClientsByCountry - which is based on a query - qryClientsByCountry - that takes a parameter, myCountry, to filter the results. I need to be able to generate this report depending on the user's choice of country, preferably from a drop-down list. Leaving aside for a...
1
1009
by: sergiockgoh82 | last post by:
I faced the problem of debugging in my Web application development. The problem as below: ASP.net runtime error: ' insufficient state return the real object ' while i try to debug in MS Visual Web Developer Express 2005 in platform 2003 server.
0
10304
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
10285
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
10063
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
9114
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
7598
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
6838
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
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
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.