User Profile & Activity

Bernard Xiang Member
Page
of 52
Posted: September 2, 2012 10:15 PM

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

Posted: August 30, 2012 1:52 AM

Hi Shri,

You can add this code on InitializeLayout event:

protected void WebGrid1_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e)
{
    WebGrid1.LayoutSettings.HeaderStyle.BackColor = System.Drawing.Color.Lime;
    WebGrid1.LayoutSettings.RowStyle.BackColor = System.Drawing.Color.LightPink;
}

Hope this helps.


Regards,

Bernard

Posted: August 30, 2012 1:43 AM

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

Hi Eric,

Perhaps, IsFlyPostBack prevent the code to be called in first initialize and this property indicate FlyPostBack event on WebGrid. Hope this helps.

Regards,
Bernard

Hi Eric,

I think the best way to do your scenario is by using DataTable that you mentioned above. In InitializeRow event we can set the value of the cells (it's not read only I think) but it seems the row has been sorted in InitializeRow. It's more elegant if we have feature for sorting by text instead of value. I'll make this feature request and I'll contact you if I heard any feedback from our developer. Thank you for your feedback.


Regards,

Bernard

Hi Eric,

Unfortunately, for now, our WebGrid take cell's value as sorting parameter. This problem occurs because the value of List_Name cell is different with its text (example: List_Name.Value = "a" and List_Name.Text = "-Fil-a-"). You can do this by set its value to same string like in the text.

I have edit your sample and attach it here. Could you check the attached sample here and tell me if there's misconfiguration and mistake that I made? And if you have any scenario that insist you to use Text as sorting parameter, I'll make this scenario as feature request. Hope this helps.

Regards,
Bernard
Hi Eric,

It's my mistake. I've tried to put grdMain.IsFlyPostBack and your project works fine. You can try to put:
If grdMain.IsFlyPostBack AndAlso Session(cSessionState_Expanded_WebGridRows) IsNot Nothing

instead of

If Not grdMain.IsFlyPostBack AndAlso Session(cSessionState_Expanded_WebGridRows) IsNot Nothing

I think this problem occurs because "Not grdMain.IsFlyPostBack" always have false value when you do FlyPostBack (it's only true when first initialize. So this prevent you to Expand Self Reference row. It's true if WebGrid do FlyPostBack on Sorting and Expand Child row. I'm using WebGrid 8 and I'm unable to reproduce this issue on our local end. I don't know what causes this matter and I'll investigate this further. But it seems we haven't got any issue about session object. Hope this helps.


Regards,

Bernard

Posted: August 28, 2012 9:23 PM
Hi Ellen,

Glad to hear that you have solved your problem. If there's anything you want to ask, please don't hesitate to ask us.

Regards,
Bernard
Hi Eric,

I can replicate your issue here. Unfortunately, I can read session object in Initialize Row event. Probably the problem occurs because this validation:
If Not grdMain.IsFlyPostBack AndAlso Session(cSessionState_Expanded_WebGridRows) IsNot Nothing
I tried to debug in here and found out that grdMain.IsFlyPostBack has false value. To resolve this, I change the code to:
If IsPostBack AndAlso Session(cSessionState_Expanded_WebGridRows) IsNot Nothing

and the problem doesn't happen in our local end. Hope this helps.


Regards,

Bernard


Posted: August 28, 2012 12:42 AM

Hi Ellen,


This error might be occurs because missing assembly in GAC( ISNet.WebUI.WebGrid.Editor.dll and ISNet.WebUI.WebGrid.Editor.v4.dll). 

To resolve this problem, you can add the assembly from your installation folder (C:\Program Files\Intersoft Solutions\WebUI Studio for ASP.NET\WebGrid.NET 7.0\Bin) to GAC (C:\Windows\assembly\) then restart the Visual Studio. Please ensure if the assembly in GAC and the assembly in you Bin folder is the same version. 

Look forward to hear any feedback from you so I can help you further.


Regards,

Bernard

All times are GMT -5. The time now is 6:43 AM.
Previous Next