Populating a cell's ValueList according to another cell's ValueList value

Answered (Verified) This post has 2 verified answers | 7 Replies | 2 Followers Thread's RSS feed.

cloucas
Points 1,450
Replied On: Thu, Jun 14 2012 10:29 AM Reply

Hi

I have an UltraWebGrid NA2010.3 to allow my users enter their timesheet; In filling out each timesheet row, they have a work type column which is of type ValueList and which is populated on page load. When filling in each row, when a value is selected, a second column Work SubType (also a ValueList) is populated based on the Work type selection. This is done in javascript using the grdTimeSheet_AfterCellUpdateHandler and calling a web method (in the code behind) returning the list to populate the SubType ValueList. This works fine.

My problem is when I load the timesheet from the database; in this case I am populating each row one at a time and setting the row's work type works as expected with the ValueList present if some user clicks on the type cell. Setting the subtype also works, but the dropdown ValueList is not populated (looks like the AfterCellUpdated handler does not work in this case?).

Is there a way I can populate the subtype dropdown foreach row based on the value of that row's type value?

  • Post Points: 20

Verified Answer

Answered (Verified) Replied On: Thu, Jun 21 2012 4:11 AM Reply
Verified by cloucas

Hello cloucas,

You should be able to have different selected values for each row's dropdown. In order to be able to investigate the issue you are experiencing, I would need to see the code you are using to populate the dropdowns, or a small isolated sample website, demonstrating your scenario. Thank you.

Best Regards,
Nikolay
Developer Support Engineer
Infragistics, Inc.
http://www.infragistics.com/support

  • Post Points: 40
cloucas
Points 1,450
Answered (Verified) Replied On: Thu, Jun 21 2012 8:27 AM Reply
Verified by cloucas

Nikolay thanks for your response.

I ended up wiring the RowActive event, and each time this happens, looking up the category cell, and if populated, I call the method to populate the sub-category drop-down; it works just fine.

Thanks for your help.

  • Post Points: 40

All Replies

Replied On: Tue, Jun 19 2012 4:17 AM Reply

Hi cloucas,

 

If I understand you correctly, you are populating the second dropdown  depending on the selected item from the first one. And this is done when you change the selection of the first dropdown and AfterCellUpdateHandler is called. When the page is refreshed, the second dropdown would be empty, unless you set its ValueList on page load. You can set these values corresponding to the first item of the first dropdown (or the selected item by default), for example in the InitializeRowHandler client-side event. So even if the page is refreshed and the user don’t want to change the selection of first dropdown, the second one will be populated.

 

Let me know if you have any questions.

Best Regards,
Nikolay
Developer Support Engineer
Infragistics, Inc.
http://www.infragistics.com/support

  • Post Points: 35
cloucas
Points 1,450
Replied On: Tue, Jun 19 2012 6:48 AM Reply

Hi Nikolay, thanks for your swift reply; I believe you have understood exactly the problem. I will try to do what you suggested, which is to also wire the InitializeRowHandler client-side (I must warn you though I am not very familiar with javascript; I had a friend of mine code the AfterCellUpdateHandler event); can i get back to you if I need any help?

Alternatively, can I wire the event server-side?

thanks

chris

  • Post Points: 20
Replied On: Tue, Jun 19 2012 8:40 AM Reply

Hi Chris,

Yes, you could also bind the dropdown in code-behind, in page load event:

UltraWebGrid1.Columns[0].ValueList.DataSource = GetDataSource();

UltraWebGrid1.Columns[0].ValueList.ValueMember = "Name";

UltraWebGrid1.Columns[0].ValueList.DataBind();

Please feel free to contact me if you have any questions.

Best Regards,
Nikolay
Developer Support Engineer
Infragistics, Inc.
http://www.infragistics.com/support

  • Post Points: 5
cloucas
Points 1,450
Replied On: Tue, Jun 19 2012 9:56 AM Reply

Nikolay hi

Looking at the problem a bit closer now, it seems that my friend is resetting the row's value list to null every time the selected row changes, by having wired the AfterRowUpdateHandler event.

I have commented out his code which sets the row's value list to null, and the drop down now retains its value after the row is changed. I however am facing another issue:

When in Row1, I select Item1 and Row1's second drop down is populated based on Row1.

I then move to Row2, select item2 and Row2's drop down is populated based on Row2.

So far so good.

In populating Row3, I decide that the second drop down in Row1 is wrong so I double-click on it to change it. I then get the options of the Row2 item rather than those of Row1.

Can the Value list populating each row's drop down be different (to reflect the item chosen in each row), or must it be the same? 

I should say here that no post back takes place when the row is changed, so it is all in client side (except the retrieval of the values from the database for each item selected which is being done using a callback)

  • Post Points: 20
Answered (Verified) Replied On: Thu, Jun 21 2012 4:11 AM Reply
Verified by cloucas

Hello cloucas,

You should be able to have different selected values for each row's dropdown. In order to be able to investigate the issue you are experiencing, I would need to see the code you are using to populate the dropdowns, or a small isolated sample website, demonstrating your scenario. Thank you.

Best Regards,
Nikolay
Developer Support Engineer
Infragistics, Inc.
http://www.infragistics.com/support

  • Post Points: 40
cloucas
Points 1,450
Answered (Verified) Replied On: Thu, Jun 21 2012 8:27 AM Reply
Verified by cloucas

Nikolay thanks for your response.

I ended up wiring the RowActive event, and each time this happens, looking up the category cell, and if populated, I call the method to populate the sub-category drop-down; it works just fine.

Thanks for your help.

  • Post Points: 40
Replied On: Thu, Jun 21 2012 8:38 AM Reply

Hi cloucas, 

Thank you for the follow up. I'm glad you solved your issue.

Do not hesitate to ask if you have any other concerns.

Best Regards,
Nikolay
Developer Support Engineer
Infragistics, Inc.
http://www.infragistics.com/support

  • Post Points: 5
Page 1 of 1 (8 items) | RSS