Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
web combo usage in Ultrawebgrid
posted

Hi, I am new to ASP.Net development. and I have problems using dropdownlist / webcombo in ultrawebgrid. The problem I have is, I am able to show dropdownlist in a column of ultra web grid. But I am not able to understand the process of retrieving the ID vales of selected item in dropdownlist.

For eg: in Customer column of UltraWebGrid, I am showing dropdownlist with CustomerId and Customer Name. I am selecting Customer Name as the display text, and the same is displayed on the grid. But during the same I have to send the Customer Id to the database. Please guide me achieving this.

I am stuck here, plase help

Thanks, robin

  • 45049
    Suggested Answer
    posted

    Robin,

    If you're using WebCombo, set the DataValueField property of your WebCombo control to the column that contains the CustomerId values you want to store in the database.  Once you've done that, you can inspect the WebGrid cell's Value property to retrieve the ID based on what the user has selected for that cell.  The cell's Text property will continue to reflect the Customer Name field, which is what is displayed to the end user.

    If you're using a ValueList, you can define a DataValue property for each ValueListItem you add to the ValueList, and that "Key" will be reflected in the Value property of the WebGrid cell when that item is selected.  Likewise, each ValueListItem has a DisplayText property, which will be reflected in the Text property of the WebGrid cell when that item is selected.