Assigning Select Parameters in Selecting event too late - why?

I had some code in the SQLDataSource selecting() event which set all my selectparameters to control values on the page (e.g. SQLDataSource.SelectParameters(0).DefaultValue = ....). However I was finding that after databinding, the SQLDataSource was only actually sending the newly assigned parameters in the 2nd call to the stored procedure. So the underlying rule seems to be don't set your select parameters in the Selecting() event of your SQLDataSource as this is too late.  I've moved it into a button click handler before the databind() was called on my GridView.  I'm sure I've done this before though?!?  Is this a bug on my part?

0
swaino
12/8/2008 4:29:56 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

2 Replies
628 Views

Similar Articles

[PageSpeed] 43

Are you using the e.Command.Parameters collection to set the parameters?


C# <---> VB.Net Translator
0
MetalAsp
12/8/2008 4:53:04 PM

Great thanks, I wondered why it wasn't working.

0
swaino
12/8/2008 5:13:36 PM
Reply:

Similar Artilces:

SELECT from SELECT
Hi! I remember seeing an example where you can do a select from a nested select, but I cannot seem to make it work. So it would be something like this: select max( name ) from ( select name from customer union select name from vendor ) Was I dreaming I saw that? Thanks! D In article <4500243f@forums-2-dub>, daniel_AT_infrontsoftware_DOT_com@N0SPAM.com says... > Hi! > > I remember seeing an example where you can do a select from a nested > select, but I cannot seem to make it work. No, you weren't. Try (UNTESTED!) adding a...

How to select everything with a select parameter?
I have SqlDatasource<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="xxxx" SelectCommand="SELECT * FROM [employee] WHERE ([status] = @status)">      <SelectParameters>         <asp:ControlParameter ControlID="DropDownList1" Name="status" PropertyName="SelectedValue" Type="Byte" />      </SelectParameters>   </asp:SqlDataSource>using a Dropdownlist1 as a where par...

How to use GridView row's Key selected for Delete as select parameter for another datasource
I'm not sure if the subject title makes sense, but it wasn't too easy to describe what I'm trying to do in one sentence! When a user clicks on the delete link in a GridView row, I want to run a stored proc, using the Key of the selected record as the parameter for the stored proc. I then want to programatically access the result of the stored proc (it'll be an integer value) for code-behind use. I wrote out a few steps to help me figure out what I need to do: 1) Get the value of PersonnelID (the DataKey) from the selected row in the GridView2) Set that Perso...

Adding a default value to sql select parameters in vb.net
Hi,     I know it's easy to select the default value if you use the sql data source object to configure your query and feed it the select parameters. However, i will like to know if it's possible or what's is the syntax to add a default value to sql query being executed before page is post back. Below is what i have so far: the text strikethrought is the missing piece i need help making it the default value.Dim connect As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("Solution_DA_LiveConnectionString").ToString()) Dim sqlcom...

Why is the select saying selected after an item is selected?
This was a whitelisting issue due to a software upgrade at hostgator..  Nothing wrong with my code..Scot King SEO Software Tool | Search Engine Optimization"Get your page rank high"  huh? It is smart to put your question in the body and not just in the title. Have no idea what your question is or if it even a question.Eric Pascarello.com | Twitter epascarello | LinkedIn use thisddl.options[ddl.selectedIndex].selected = false; //Clear the selection ddl.options[1].selected = trueMAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Sit...

select cheboxlist if any values are selected in sql
hello and thanks in advance,  I have a checkboxlist that is created dynamically from table1 once the records are inserted they are inserted in table2. i can save the values into the table and remove them if i uncheckd them that is working fine. the problem is to checked the items that have been selected already, how to i do this?? really really confuse...   here is the cs code; namespace IMS_2K9.Admin { public partial class Order_Charges : System.Web.UI.Page {private string connectionString = WebConfigurationManager.ConnectionStrings["IMSCon...

Quick Select & SQL Select
What difference between "Quick Select" & "SQL Select" in DataWindow ? E-mail me PLS -- Leonid ANTISPAM ! SORRY!!! My e-mail is not correct: zzz_leo@softincom.ru Remove 'ZZZ_' from E-mail ICQ UIN: 7281017 Quick Select uses wizards and has limited capabilities. SQL Select is a point and click and lets you do a lot more. Plus you need to know the SQL Select approach if you want to modify a Quick Select after the initial creation. HTH, Mark -- Mark Pfeifer[Team PS] mpfeifer@sprynet.com ** ARE YOU READY FOR THE WEB...

SqlDataSource events selecting and selected not work
When I handle a event for selecting to change the value of a parameter it does not use the new value and the selected event is never called. What am I doing wrong?   protected void OptionListSource_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { string productID = Request.QueryString["p"].ToString(); SqlDataSourceView Source = (SqlDataSourceView)sender; Source.SelectParameters["ProductID"].DefaultValue=productID; } protected void OptionListSource_Selected(object sender, SqlDataSourceStatusEventArgs e) { SqlDataSourceView Source = (SqlDataSourceView)sender; } ...

Multiple Selects
Is it possible to specify more than one select in the Infomaker SQL Select Painter? Example: SELECT Tab1.Num FROM Tab1 SELECT Tab2.Ref FROM Tab2 If it is possible, please let me know how can I do that. If it isn't possible, how can I overcome this issue? Thanks and regards, Filipe Freitas Yes, inside a UNION. "Filipe Freitas" <filipe.freitas@hp.com> wrote in message news:435f98ea$1@forums-2-dub... > Is it possible to specify more than one select in the Infomaker SQL Select > Painter? > > Example: > SELECT Tab1.Num FROM Tab1 ...

SqlDataSource Selecting/Selected events not firing
Hi,I have a SqlDataSource and am trying to establish if it returns rows using the selected event e.AffectedRows statement. Unfortunately the selected event does not fire. I am using a stored procedure with 2 parameters:applicantID - Int32 - Parameter source from control label textissueStatus - Int16 - Parameter source 'None' default value = 1 When i test it during configuration it returns 1 row as expected. I am manually running the DataSource using ds.DataBind(); after a button click. Anyone know why its not firing the event?Thanks  Solved it. The problem was with...

Raise Event when a selected date is selected again in Calendar
Hi all,When I view source of the rendered page that contains a calendar control, I see it's a table, with a child table where each date is a table cell calling the all powerful __dopostback function with the calendar id as the event target and a unique numeric string as the event argument.Since the selected date is also containing the dopostback function, could that be exploited to call a routine during page load due to postback.I have come upto this and got stuck after that.'aspx.vb code snippet:If TypeOf sender Is Control Then     dim ctl as control  &...

Iwant to select a row and column in gridview with select radiobutton. but No checked change event.below put a button .if click that button to seleced row values will select
I want to select a row and column in gridview using radiobutton in gridview . if which radio button is select that row will select and i want that row column values in outside individual textboxes of next page.  but in that only single radiobutton will select and no post back="true" bcz iam not using checked change property. i inserted button below gridview. if i click the that selected row and columns values are stored into textboxes of next page im using this code .but im getting one column in that row. but i want all columns in that selected row so plz repla...

Best way to filter some gridview results
I have a gridview that displays some data from an object data source. Above the gridview i have about 4 drop down lists and a text field - all of which are intended to provide filtering / searching of the GridView. I am kind stuck on this because previously i was using filter parameters to do this kind of stuff - just return the whole data set and use multiple filter parameters to filter ther data.  This works okay with one or two drop down lists (i use code in the ItemFiltering event of the grid to analyze and drop downs and set defaults for filter parameters but with four its ...

Parameters with sql select statement
I am new to asp.net programming.  I have a sql server database table with the following fields: id, name, auth_code.I have a web page with a text box, label, and a button.  I want to be able to enter an auth_code in the text box and when they click the button display the name in the label.  Auth_code is a unique field so there can only be one record.  Query: SELECT name from table where auth_code = @auth_code.My question is do I use a sqlDataSource?  or  something like: Dim myConnection as New SqlConnection(connection string)myConnection.Open()Then open a data r...

Web resources about - Assigning Select Parameters in Selecting event too late - why? - asp.net.sql-datasource

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google Webmaster Tools Parameter Handling - Flickr - Photo Sharing!
You aren't signed in Sign In Help Home The Tour Sign Up Explore Explore Home Last 7 Days Interesting Popular Tags Calendar Most Recent Uploads ...

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 12/15/2015 7:30:01 PM