Forum
 
 
Knowledge Base Forum
To post messages on the forum, you need to login first.
SearchForum Home
  Product Forums  smartDBforms.NET  Display text lo...
 Display text lookup on insert form
 
 6/10/2010 8:35:05 PM
David
10 posts


Display text lookup on insert form

Is there a way to display a name from another table on an insert form that is derived from the ID# that is entered by the user. This ID# is entered into tghe field for the table that will be inserted with the rest of the data.

In other words I have the user entering their ID# (that ID# entry will be inserted)and  I want to lookup the name that correspnds to that ID# from another table in the db and display it as visual reference.

Originally I wanted to use a ddlist to automatically fill that ID# from a selection made by the user, listing the Lname of the other table, but I had many issues with trying to get that accomplished and gave up.

 6/11/2010 9:27:36 AM
Adillis Support
43 posts
adillis.com


Re: Display text lookup on insert form


Hi David,

You can achieve this by adding new SmartDataSource and SmartDBView which will display the user details. The SmartDataSource will have Select parameter with the user id and SmartDBView will display the user details in ReadOnly mode. There will be a button next to the UserID entry user interface which when pressed will display the entered user ID details in the additional SmartDBView.

This is the detailed steps to add user details panel:

  1. Add new SmartDataSource

  2. Add new SmartDBView and select its data source to be the newly added data source. You can put the SmartDBView either inside the main SmartDBView or outside it.

  3. Configure the SmartDataSource to have Select statement for the users table with one parameter in the where clause that will determine the user to select. For example:
    SELECT * FROM Users WHERE (UserID = @UserID)

  4. Press Refresh in order the parameter to be parsed and added to the SelectParameters list.

  5. Press OK and allow the user interface to be generated for the new SmartDBView. Delete the generated command buttons because you don't need them.

  6. Set the SmartDBView default mode to be ReadOnly.

  7. Set the SmartDBView OnEmptyData property to EmptyDataTemplate.

  8. Edit the EmptyDataTemplate to show some text to the user that no data is available and he have to press the “Get User Details” button when he entered the user id. From SmartDBView smart tag select “Edit Templates” command and enter some text in the template. For example: No data. Press "Get User Details" to get details for the selected UserID.

  9. Add new Button next to the user interface where the User ID is being entered. This button will extract the currently entered user id and pass it to the new SmartDataSource for extracting the user details.

  10. Set the name of the button to be "Get User Details". Set the button property CausesValidation to false.

  11. Double click on the button so that the event handler is generated.

  12. In the event handler add code to set the Select parameter values to be the currently entered user id. For example:
    protected void btnGetUserDetails_Click(object sender, EventArgs e)
    {
     sdsUserDetails.SelectParameters[0].DefaultValue = ctrlUserID.GetCurrentValues()[0].ToString();
    }

If you have any other questions, we will be more than happy to help you.
Best wishes,
Adillis Support
Adillis - IT solutions http://adillis.com

  Product Forums  smartDBforms.NET  Display text lo...
Copyright 2006-2010 Adillis Terms Of Use Feedback Contact Us