Cannot change SELECT command Datalist

Hi , 
I have a datalist with a selectedcommand , but i want to change it at runtime ( i have a dropdownlist and want to search based upon the values of dropdownlist) , I used this in button click event:
if (DropDownList1.Text=="blabla")
            this.SqlDataSource1.SelectCommand = "SELECT prodID,[Prodname], [Price], [ProdCode], [Weights], [Size], [Photo] FROM [Products] where Cat='ct1' and Price<10000 ";
            this.SqlDataSource1.DataBind();
            DataList1.DataBind();
but  nothing happens. I also tried http://social.msdn.microsoft.com/Forums/sqlserver/en-US/b1d4a3a5-7ba3-4383-a52a-fd472f1aad11/change-sqldatasource-select-command-at-runtime?forum=Offtopic 
but it doesn't work for me . any ideas ?

Hi,
Try the below code.
if (DropDownList1.Text == "blabla")
SqlDataSource SqlDataSource1 = new SqlDataSource();
SqlDataSource1.SelectCommand = "SELECT prodID, [Prodname], [Price], [ProdCode], [Weights], [Size], [Photo] FROM [Products] where Cat='@cat' and Price < @price";
SqlDataSource1.SelectParameters.Clear();
SqlDataSource1.SelectParameters.Add("cat", TypeCode.Int32, "1");
SqlDataSource1.SelectParameters.Add("price", TypeCode.Decimal, "1");
//your connection string from web.config
SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString;
DataList1.DataSource = SqlDataSource1;
DataList1.DataBind();
SRIRAM

Similar Messages

  • Cannot change SQL command text in Data Flow Task

    I have an SSIS package that extracts data from Teradata into a SQL Server DB.
    I'm using SQL Server 2008 R2 EE x64, and Visual Studio 2008 PE (BIDS) supplied with it, accessing Teradata v13.
    In the Integration Services project, I have a Data Flow Task, it has an ADO .net source which has Data access mode set to “SQL Command”.
    This worked for a while when I initially entered a SQL statement to select data.
    But, when I change the existing SQL Command text and save the package, the changes are lost.
    It keeps going back to the original SQL Statement.
    It is currently “select col1, col2, … col10 from view1”.
    When I change it to anything else, like “select col5 from view1”, and save, and then double click the ADO NET source again, I find that the SQL command text is still the old one. It goes back to the previous statement.
    I’ve tried other statements like “exec macro” for Teradata, etc. but the same thing keeps happening - changes are not saved.
    Does anyone have any ideas on this, or have you seen this before?

    This is odd, but seems to be a component metadata corruption; so why don't you:
    delete the teradata connector and source component, then re add them back, see if it now accepts the new SQL statement, if this does not work
    abandon this package and create a new one replicating the functionality incorporating the new SQL.
    In case #1 and 2 both fail post here any errors observed and find out whether you are missing any updates to either Teradata provider or SQL Server
    Arthur My Blog

  • In iTunes under my device, under the apps tab, Why are all the options shaded out?  I cannot make any changes, select any apps or do anything with the apps.  I was able to load a few apps and sync but cannot sync anymore to my phone.

    In iTunes under my device, under the apps tab, Why are all the options shaded out?  I cannot make any changes, select any apps or do anything with the apps.  I was able to load a few apps and sync but cannot sync anymore to my phone.

    Hi,
    ( I search for iChat questions when I have finished in the iChat Forum)
    So the menu bar reads iChat, File,  Edit,  View, Buddies, Video, Window and Help
    There is no Buddy List open.
    There is no other window for iChat open.
    In the iChat Menu you only have access to Status.
    Is an item ticked in the list ?
    Is this a green (Available item) or  Red ( an Away one) ?
    Can you access the Accounts option ?  (Sitll in the iChat Menu)
    Is anything in here ticked ?
    In the Window menu any Logged in account should appear in the list  (Between the Next Chat and File Transfer items)
    It would be useful to know which version of iChat this is.
    If no account is ticked (iChat Menu > Accounts) or not showing in the Window Menu, plus you cannot determine the Status and you cannot access the Preferences then you need to access your Home Folder/Library/Preferences
    As the Library in the Home Holder is Invisible in Lion you will need the Finder's Go Menu > Go to Folder option  (you can use it in earlier OS versions if you want)
    Type in:-
    ~/Library/Preferences
    Find the file called com.apple.ichat.plist
    Drag it to the Trash and Restart iChat.
    This will lose all the settings in iChat that you have changed from Defaults but there is no way around this.
    9:23 PM      Saturday; August 27, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb( 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • All tools in panels toolbar are disabled meaning I cannot change to any of the alternatives-E.g. Cannot select various Type tools as when I drag out I get the "disabled (Stop symbol)". Really need help with this, been like this for a while now. Many Thank

    Panels tool bar is completely unresponsive. Cannot change to any of the alternatives.
    I am using The most up to date Adobe Illustrator CC on Yosemite.

    I actually can't believe I was being that stupid.
    Thank you very much! This solves the issue.
    Many Thanks,
    Ronan

  • Cannot change command and control button

    in the past I've been able to switch the command and control buttons from system preferences. I recently connected a new Microsoft keyboard to my mac mini, and when I change the command and control button the same way I did before, it has no affect. The command and control keys have their default action. Is there a way to over ride this?

    I did on Lenono brand windows keyboard and it works, but when I try a Microsoft brand windows keyboard, it doesnt work.

  • Select Command Le check. Can't get the Le.

    Hello all.
    I have a question.
    I am making an applet.
    Into the Select command, I think my applet cannot get the Le data.
    The Le value has always '00' even though the select command Le value has been changed.
    First, in order to get the Le, I used the apdu.setOutgoing(), which returns Le, and then I checked the Le != 0.
    However, I think the setOutgoing() always returns '00' in my applet, and the applet does not perform the checking Le statement.
    I guess my testing environment or performing follow has a problem, but I am not sure.
    I want to hear your opinion and how to test in this case.
              short idl = apdu.setIncomingAndReceive();
              byte[] apduBuffer = apdu.getBuffer();
              short le = (short)(apdu.setOutgoing() & (short)0x00ff);
              if(apduBuffer[ISO7816.OFFSET_CLA] != CLASS_ISO)
         CardException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
              Util.arrayCopy(fileControlInformation, (short)0, transientData, TD_OFF_FILE_CONTROL_INFORMATION, (short)fileControlInformation.length);
              if((apduBuffer[ISO7816.OFFSET_P1]!=(byte)4) || ((apduBuffer[ISO7816.OFFSET_P2]!=(byte)0)))
         CardException.throwIt(ISO7816.SW_INCORRECT_P1P2);
              if((apduBuffer[ISO7816.OFFSET_LC] == (byte)0) || (idl == (short)0) || (apduBuffer[ISO7816.OFFSET_LC] != (byte)idl) || (le != (short)0))
                        CardException.throwIt(ISO7816.SW_WRONG_LENGTH);
    For example,
    00A4040007xxxxxxxxxxxxxx01<<9000
    Although wrong Le is added, the applet returns 9000.
    I know why the applet returns 9000.
    The point is how to test it correctly.
    Thank you.
    글 수정: Jin

    not really, "select application" can return whatever you like, and most applets do return something: a file control information template (fci) giving the AID and other info (for an example, try to select a card manager). That's a good practice: because you can select an application with only part of an AID, the applet usually replies with this complete AID. [tell the card: "Hello ath", she will respond "Hello, understood, but if you want to know, my full name is Athena" :) ]
    Jin, can you post your whole process() algorithm for the select command, including: how are you returning data? do you use apdu.SendBytes() ?
    if you have a contactless card it is possible that Le is always zero, because according to iso7816 zero means "all available data".
    why? because a contactless card (or a T=1 card) can return any length without prior indication, so it does not need Le.
    or it might be a bug in your javacard implementation...
    You can use apdu.SetOutgoingLength() to indicate the real length of the response, and usually the card OS (below javacard) relies on that to create a 6CXX response if there's a problem.
    A workaround can be: Read Le in the apdu buffer at the correct offset, and send a 6CXX SW yourself if you're not satisfied with it.
    I'm expecting more details from you to fully understand the problem.

  • Dreamwever CS5 ERROR server behavior panel cannot determine wheter "command" or "recordset (Query)"

    i get this error whenever i open pages created in CS4. ive tried deleting the cache file... deleting the entire configuration folder and letting DW re build it.. nothing... error still there. how can i turn it off? i also cant seem to find the "edit server behaviors" button.. double click? well DW freaks out with that aswell... yes i know i have some insanely hand edited code.. basically use DW as notepad replacement.. with extra features like having the option of "add recordset" then going and editing it to my liking.
    the error
    [quote]
    The server behavior panel cannot determine whether "command" or "recordset (Query)" is applied to your page. Please select edit Server Behaviors and change one of the two behaviors to ensure that each is uniquely identifiable.
    [/quote]
    this is a total show stopper for me.. im going to have to go back to a previous version cant click "ok" every time i open a page.. and every time i follow a include file.
    development ASP
    Dreamweaver CS5
    Question.. how to disable the error message from popping up? i'll take my chances with hand editing the recordset / command by hand if i need it changed.

    this is bleh... having to resort back to CS4..
    is there any way to legaly go back to cs4 dreamweaver but still use the other cs5 applications?

  • The Server Behavior panel cannot determine whether "Command" or "Recordset (Query)" ...

    Suddenly getting this goofball message in DW5.5 on Win7:
    "The Server Behavior panel cannot determine whether "Command" or "Recordset (Query)" is applied to your page. Please select Edit Server Behaviors and change one of the two behaviors to ensure that each is uniquely identifiable."
    Crazy thing is, it only happens on my workstation.
    DW5.5 on my laptop opens the same .asp pages without this crazy message popping up.
    Anybody know what the issue is?

    I'd suggest that no answer means no answer yet. The person who can help may not have been on the forum the day the post was made.
    That said, I'm starting to suspect that the cause must be an extension. Both boxes have the same version of DW and the same OS but both don't have the exact same extensions installed. Will play around and see what happens.

  • Big Permissions Problem: "You Cannot Change The Contents Of This Folder"

    I installed Tiger some time ago (and need to upgrade now from 10.4.6 to 10.4.9).
    I haven't used it much since some of my software will only run under Panther.
    In any case, I'm using it now and have been having big permissions/user accounts problems.
    I have two users on the computer "robert" and "ra", both with admin privileges (I set up two because I was trying to get around these problems -- I'd be very happy with just one).
    I have 10.4.6 installed on an external HD and boot from that into Tiger (I have Tiger on another external HD as a backup, and my main HD in the iMac has 10.3.9 -- that's what I boot from when I need to run older programs).
    In any case, both "robert" and "ra" have ADMIN privileges. But I get weird ownership problems. For instance, if I am logged in as "ra" and try to play a Realplayer file streaming from the web (in Firefox 1.x), I get the error
    /Users/robert/Desktop/307e6wz7 could not be saved, because you cannot change the contents of that folder.
    I check the ownership of the "Desktop" folder -- read/write for "ra".
    If I right-click I can save the Realplayer file to the desktop.
    Same with other links.
    I've also noticed other ownership problems (blocked folders at finder level) but can't duplicate tonight. Is this an obscure error, or is there something amiss in ownership recognition? Is there some way I can sort all out? Login in as "root" and set all right?
    Thanks
    G4 iMac   Mac OS X (10.4.6)  

    Yes they do. When you installed them you dragged these particular apps to the Applications folder. Doing so automatically attributes the program with the ownership attributes of the account owner who installed them - 'robert.'
    Proper application installers install apps under the system/admin ownership. You can try to fix these apps by changing their permissions:
    Select the app and CTRL-click to open the contextual menu. Choose Show Package Contents from the contextual menu. Select the Contents folder and press COMMAND-I to open the Get Info window. In the Ownership and Permissions section click on the tiny arrow icon to expose the panel. Click on the little lock icon to authenticate. Change permissions as follows:
    Owner = system with Read/Write privileges
    Group = admin with Read/Write privileges
    Other with Read-Only privileges
    Click on the Apply To Enclosed Items button. Close the lock by clicking again on the lock icon.

  • Cannot change password or admin login

    i have done everything i was advised to do but it just cant work bcus has tied the password and admin login
    some were in the computer.some people advised that i should take it to an apple store in my country
    but we dont have an apple store or a representative in cameroun, what next do i do?pls help

    Hello:
    Ok here we go:
    1- You have to restart your MBA holding down the Command+S keys, and this will take you into Single User Mode and it’s Terminal interface.
    2- Then you have to check the filesystem. to do this you have to type the following command in the terminal interface:
    fsck -fy
    3- Then you have to mount the root drive with write option enabled so you can apply and save any changes. Type this in the temrinal interface:
    mount -uw /
    4- And then type this command exactly as you see it here:
    rm /var/db/.AppleSetupDone
    5- Reboot your MBA by typing this in the terminal interface:
    reboot
    6- After you reboot, you will be see the “Welcome Wizard” startup screen. Follow the wizard and create a new user account. This new account name must be different from the one you already have
    7- Continue and boot into your Mac OS X with the new account you have just created, this new user account is an Administrator and has administrative access
    8- Now that you're logged in, go to System Preferences
    9- Click on Users & Groups
    10- Click on the Lock icon and use your newly created user name and password if asked. This will allow you to make changes to other user accounts
    11- On the user panel select the user account whose password you cannot change and then click on the Change Password... button and enter your new password.
    12- Delete, or grant administrative privileges to that old account
    13- Reboot/restart your MBA and now you can log back in with your old account. If you want you can delete the user account you created following this steps.
    Hope this helps.
    Good luck

  • I cannot change apple id when the app store asks me to update anything

    i cannot change apple id when the app store asks me to update anything

    App Store products can only be updated by signing in to the store with the same Apple ID that was originally used to download them. You can't update anything, including your own purchases, as long as there are pending updates linked to the other ID.
    If you can't sign in with the other ID, you have to delete all the apps that are linked to it. If you don't know which apps those are, see below.
    1. Triple-click anywhere in the line of text below on this page to select it:
    kMDItemAppStoreHasReceipt=1
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    2. In the Finder, press command-F to open a search window, or select
              File ▹ Find
    from the menu bar. In the search window, select
              Search: This Mac
    from the row of tokens below the toolbar. Below that is a popup menu of search criteria, initially showing Kind. From that menu, select
              Other...
    A sheet will drop down. In that sheet, select
              Raw Query
    as the criterion, then click OK or press return.
    Now there will be a text box to the right of the menu of search criteria. That's where you enter the raw search query. Click in that box and paste the text you copied earlier by pressing command-V.
    3. The search window will now show all the App Store products that are installed. Compare those search results with the list of your purchases from the App Store. To see the complete list, you may need to unhide hidden purchases. If any apps were download from the App Store using other Apple ID accounts that you control, sign in to the store under each of those ID's and check the purchases.
    4. At least one of the apps in the Spotlight search results is not among your purchases in the App Store. Delete each such item by following the instructions in the Apple Support article linked above.
    5. Quit and relaunch the App Store.
    If you find these instructions confusing, ask for an alternative method.

  • HW-MODULE UPLINK SELECT command missing on 4507R+E Sup7-E IOS 15.1(2) SG4

    We have a 4507R+E with dual Sup7-E's running IOS 15.1(2) SG4.  The license level is LANBase.  I am creating the initial configurations for the switch but cannot change the uplink state of the SFP ports on the supervisors.  I tried to run the command HW-MODULE UPLINK SELECT but it is not present.  These are the only option available under HW-MODULE.
    switch(config)#hw-module ?
      module  Specify a linecard slot for the hw-module command
      slot    Specify a linecard slot for the hw-module command
      system  Specify the system parameter
    Is this a license restriction?

    On a 4507R+E, "hw-module uplink select all" is enabled by default, however, because you've got redundant Sup card, the uplink ports 3 & 4 are disabled permanently. 
    This is because the backplane speed of the chassis is 48 Gbps.  So you can only use up to four (4) 10 Gbps interfaces.

  • HT201262 cannot go to cmd+V or S, I cannot change my password. -error message ===boot file path system library coreservices boot.efi.... Please help.

    cannot go to cmd+V or S, I cannot change my password. -error message ===boot file path system library coreservices boot.efi.... Please help.

    Got it thanks macjack . Command + S on restart.
    In this case Nad69-Breizh did you try restarting with the option key down and re-selecting the boot drive.
    If no Recovery option,  try command option R  for internet recovery. Takes some time to load up.

  • When I use the shortcut to open a new window in safari (command N), I get a 404 error message from Google. How do I change where 'Command N' routes to?

    When I use the shortcut to open a new window in safari (command N) on my Macbook Pro, I get a 404 error message from Google. How do I change where 'Command N' routes to? 

    It's not necessary to change the Command N keystroke..
    From your Safari menu bar click Safari > Preferences then select the Privacy tab.
    Click:   Remove All Website Data
    Then delete the cache.
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.
    If that didn't help, troubleshoot Safari extensions.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.

  • "Function code cannot be selected" error while uploading a document.

    Hi,
    When we try to upload a document into SAP the user is getting the error "Function code cannot be selected". Detailed error is given below. Only one user is facing this error in PRD. For all other users it is working fine. We replicated the same issue in testing systems and it is working fine there with the same user's id.
    The detailed error is,
    No batch input data for screen SAPLF040 0300
    Message no. 00344
    Diagnosis
    The transaction sent a screen that was not expected in the batch input session and which therefore could not be supplied with data.
    Possible reasons:
    1. The batch input session was created incorrectly. The sequence of screens was recordly incorrectly.
    2. The transaction behaves differently in background processing in a batch work process than when running in dialog (SY-BATCH is queried and changes the screen sequence).
    3. The transaction has undergone user-specific Customizing and therefore certain screens may be skipped or processed differently, according to the current user. If the person who created a batch input session is not the same as the person now processing it, this problem may occur frequently.
    System Response
    None.
    Procedure
    For 1: Either re-create the session or process it in expert mode. Correct the batch input program.
    For 2. It is very difficult to analyze this problem, particularly in the case that the screen sequence or the display-only options of fields differ according to whether the transaction is being processed in the background or as an online dialog. It could also be that this kind of transaction cannot run with batch input.
    For 3: Have the creator of the session process it. If no error occurs now, then this is a program with user-specific Customizing.

    Hi Amar,
    I am facing the same issue while processing Vendor master inbound idocs, Few Idocs gone in error with error message "Function code cannot be selected".
    Could you please suggest any solution found for the same.
    Thanks in advance
    Shivam

Maybe you are looking for