Combo in a grid not getting refreshed

8 replies. Last post: September 3, 2012 2:18 AM by Bernard Xiang
Tags :
  • (None)
Shri ShriMember

Hi

I am having two grids on page. I have to show the serial numbers from the grid one as the combo items of the secon grid. Both the grids will be saved on the one save button at a time. i am saving the first grid changes in the session. so on the click of second grid web combo column the newly added serial numbers are not shown.By combo getting filled up at page load and at  preparedatabinding. Please give me the solution.

Answers

Hi Shri,

I think, to achieve this scenario, you must do Postback to get the data from the session or WebGrid. I tried many ways to achieve this scenario but unfortunately it still have to call the data from WebGrid and Session on Postback.

The best way to do this scenario is when you edit the WebGrid you bind Datasource in WebGrid to WebCombo so data in WebCombo is the same as WebGrid. Or you can put datasource in WebGrid as DataTable inside the Session and bind it to WebCombo.

Hope this helps.


Regards,

Bernard

All Replies

Hi Shri,

I'm a little bit confuse about your scenario that you mentioned above. But I think the problem comes when you open the WebCombo on 2nd WebGrid (the value of WebCombo hasn't been updated yet). For this issue, I've made my own sample. Could you look for my sample? And if there's any misconfiguration of wrong scenario that I made, could you explain me step by step the scenario that you want to achieve?


Regards,

Bernard

Shri ShriMember

Hi Bernard

Thanks For your reply. Let me explain you my flow. As the above solution is solving my problem.

1> I have two grids on my page. In First grid the serial Numbers are entered on the page load as fixed set of rows that is 5. So for row 1(that is serial Number 1) I select a value from the second column which is the dropdwon for the State. This changes i capture in the session. Nothing is saved  in the database.

2> In the second grid.First column is a dropdown which has the above Serial numbers. On selection of the serical number i show the state in next colum .

 My problem is as i am updating the session the dropdwn is not updating. I checked your code but it needs postback to get the Dropdown loaded again. Is there any other way to load dropdwn with new Values without doing the postback. Please Help.

Shri ShriMember

Hi Bernard

Thanks For your reply. Let me explain you my flow. As the above solution is solving my problem.

1> I have two grids on my page. In First grid the serial Numbers are entered on the page load as fixed set of rows that is 5. So for row 1(that is serial Number 1) I select a value from the second column which is the dropdwon for the State. This changes i capture in the session. Nothing is saved  in the database.

2> In the second grid.First column is a dropdown which has the above Serial numbers. On selection of the serical number i show the state in next colum .

 My problem is as i am updating the session the dropdwn is not updating. I checked your code but it needs postback to get the Dropdown loaded again. Is there any other way to load dropdwn with new Values without doing the postback. Please Help.

Hi Shri,

I think you can use WebGrid's DataSource as your WebCombo DataSource. You can do it by using this code:

DataTable dt = (DataTable)WebGrid1.DataSource;

Then inside DataTable, you can put the changes in Session as new DataRow. Then you can rebind the DataTable with WebCombo1 when you Initialize WebGrid or change WebGrid. Hope this helps. If this doesn't meet you scenario, could your tell me what changes that you save inside the session?


Regards,

Bernard

Shri ShriMember

Hi

On Rowadd from the Clienside i call pagemethod and i save the grid changes in the session.

I checked when i call the intialize datasource of Combo the session shows the updated changes that is State for the corresponding Serial number.

But when i click on the Webcombo colum of grid the webcombo does not refresh with new changes. But under preparedatabinding in the webcombo datasource i can see the newly created item.

If i put the Postabakc button the Combo gets loaded with the new values. But i dont want to put the postback button. Please help

Hi Shri,

I think, to achieve this scenario, you must do Postback to get the data from the session or WebGrid. I tried many ways to achieve this scenario but unfortunately it still have to call the data from WebGrid and Session on Postback.

The best way to do this scenario is when you edit the WebGrid you bind Datasource in WebGrid to WebCombo so data in WebCombo is the same as WebGrid. Or you can put datasource in WebGrid as DataTable inside the Session and bind it to WebCombo.

Hope this helps.


Regards,

Bernard

Shri ShriMember

Hi,

I already did the thing by doing postback. Thanks anyways

 

Hi Shri,

You're welcome. Glad to help you.


Regards,

Bernard

All times are GMT -5. The time now is 9:58 AM.
Previous Next