Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    AutoFilling an edit form using C#.NET and SQL

    Hello fellow Coders,

    I am fairly new to ASP.NET, mainly C#.NET and am wondering how I can autofill a form. I know this is extremely vague, because autofilling a form can stretch from textboxes, to dropdowns.

    I want help, in particular, with dropdowns, since a drop down is the first thing on my add form(which I want to auto-complete most of and allow the end user to edit...then save)

    In general I want to populate a dropdown using a query, but also having one of the values from the dropdown already selected. I have no problem simply populating the dropdown.

    Please assist in anyway you can, your help is greatly appreciated!
    Thank you again!!

    MyName.

  • #2
    Regular Coder
    Join Date
    Apr 2009
    Posts
    244
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Hey MyName. ,

    In your codebehind (most likely inside the Page_Load), just do something like this:

    Code:
    .
    .
    MyDropDownList.SelectedValue = "My Selected Value";
    .
    .
    For a DropDownList control, there are also SelectedIndex and SelectedItem properties you might want to look at. For a TextBox control, the property is Text. Anyway, all you have to do is look for those controls on MSDN - that will answer all such questions.

    Regards,
    Mike

  • Users who have thanked Mike_O for this post:

    MyName. (06-08-2011)

  • #3
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yes I am aware of those properties, however, I don't know how to use a query to make it all happen.

    Here's some more detail on the question:
    I want to run a query that gets an ID (one column one value)

    I want to use that value in another query which will get me the value I want to select then use that value to select from a list created using a third query.

    Thank you so much for your response, all of the edit pages I have seen do not do this...they just require an unfiltered column :/

    Please help me if you can, I really do look forward to hearing form you. If you need anymore clarification let me know

  • #4
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I think the best way to approach my problem is using a query string with more than 1 parameter and then use the selected... operator on the autofill function (automatically inputs data with a said ID) ..

    I will post a solution to those who want to see it for future reference (beginners like myself) once I finish this edit form.

    Thank you so much for those that viewed this thread


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •