iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I have a webgrid that performs a client-side refresh based on a timer. After the postback occurs, the grid is updated as expected after the page life cycle. I also have a need to update other UI elements such as a WebButton but ONLY the grid's data/UI is updated. Typically, I would wrap the button in an UpdatePanel so that AJAX would update the UI.
How do I accomplish this using the WebButton/WebGrid scenario I described?
I usually use the WebGrids Client Side Event OnAfterResponseProcess
There is a listing of common actions for the WebGrid somewhere
Something like this...
function WebGridTimesheet_OnAfterResponseProcess(controlId, actionName, lastRequestObject, xmlResponseObject) { switch (actionName) { case "Refresh": //Update some controls here break; case "DeleteRow": //Do something else here break;
}
The ClientSideEvents are under the LayoutSettings in the Properties window
I usually use the WebGrids Client Side Event OnAfterResponseProcess There is a listing of common actions for the WebGrid somewhere Something like this...function WebGridTimesheet_OnAfterResponseProcess(controlId, actionName, lastRequestObject, xmlResponseObject) { switch (actionName) { case "Refresh": //Update some controls here break; case "DeleteRow": //Do something else here break; }} The ClientSideEvents are under the LayoutSettings in the Properties window
That's not what I am looking for. The Refresh is just the action that is causing the postback. After that postback occurs, I need to have the UI changes made on the sever side be reflected after the postback. Using AJAX, one would add the control to an UpdatePanel. That doensn't work here.
Hello,
For UI changes can be made on the server side only if the page is on FullPostBack mode. However, refresh is a FLyPostBack action. So, for UI changes, it is better if you do it in client.But if you would like to do in server, try the following code.
protected void WebGrid1_InitializePostBack(object sender, ISNet.WebUI.WebGrid.PostbackEventArgs e) { if (e.Action == PostBackAction.RefreshData) { WebButton1.Enabled = false; WebGrid1.ClientAction.RenderControl(WebButton1); } }
Regards,Handy
Hello,For UI changes can be made on the server side only if the page is on FullPostBack mode. However, refresh is a FLyPostBack action. So, for UI changes, it is better if you do it in client.But if you would like to do in server, try the following code.protected void WebGrid1_InitializePostBack(object sender, ISNet.WebUI.WebGrid.PostbackEventArgs e) { if (e.Action == PostBackAction.RefreshData) { WebButton1.Enabled = false; WebGrid1.ClientAction.RenderControl(WebButton1); } } Regards,Handy
Do you have a simple example? I am getting a JavaScript error using that approach.
I also tried the WebButton's RequiresUIRefresh method but it didn't work.
ISRes.asxd - Line 11 Invalid Character
IS.RenderControl("ctl00_WebPaneManagerShell_ViewContentShell_ContentPlaceHolder_ucAdjustmentFactorReports_btnCreateReport", "<xml id=\'ctl00_WebPaneManagerShell_ViewContentShell_ContentPlaceHolder_ucAdjustmentFactorReports_btnCreateReport_x\'><!--[CDATA[<CompressedXml><WebButton Text=\"Create Report\" Image=\"/Endurance.Re.AWB.Web/Images/16x16/wg5_newrow.gif\" DisplayMode=\"TextAndImage\" AutoPostback=\"a\" DisabledStyle=\"W112GFA\" ProgressTextStyle=\"W1DJCD0\" ServerUniqueID=\"b$c$d$e$f$g\" UseWebResourcesForScript=\"a\" UseWebResourcesForClient=\"a\" xmlInputHiddenUniqueID=\"b$c$d$e$f$g$btnCreateReport_h\" XmlCompressionEnabled=\"a\"><ButtonStyle Normal=\"W32AJ17\" Over=\"W8J3G1\" Active=\"W32GGF8\" /><FlyPostBackSettings /></WebButton><ISXMLMapping><NodeKey /><NodeValue /><AttrKey /><AttrValue /><ValKey>gebafdc</ValKey><ValValue>btnCreateReportContentPlaceHolderctl00TrueucAdjustmentFactorReportsViewContentShellWebPaneManagerShell</ValValue></ISXMLMapping></CompressedXml>]]--></xml><button id=\'ctl00_WebPaneManagerShell_ViewContentShell_ContentPlaceHolder_ucAdjustmentFactorReports_btnCreateReport_f\' class=\"W32AJ17 \" style=\'height:20px;width:125px;\'title=\'Create an adjustment factor report\' ><div><img align=absmiddle src=\'/Endurance.Re.AWB.Web/Images/16x16/wg5_newrow.gif\' hspace=2 /> Create Report</div></button><input type=\'hidden\' id=\'ctl00_WebPaneManagerShell_ViewContentShell_ContentPlaceHolder_ucAdjustmentFactorReports_btnCreateReport\' name=\'ctl00$WebPaneManagerShell$ViewContentShell$ContentPlaceHolder$ucAdjustmentFactorReports$btnCreateReport\"ctl00$WebPaneManagerShell$ViewContentShell$ContentPlaceHolder$ucAdjustmentFactorReports$btnCreateReport$btnCreateReport_h\" type=\"hidden\" id=\"ctl00_WebPaneManagerShell_ViewContentShell_ContentPlaceHolder_ucAdjustmentFactorReports_btnCreateReport_btnCreateReport_h\" />");InitWebButton(\'ctl00_WebPaneManagerShell_ViewContentShell_ContentPlaceHolder_ucAdjustmentFactorReports_btnCreateReport\');
/// <summary> /// Handles the Reports WebGrid control's OnInitializePostBack event /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event Arguments</param> protected void grdReports_OnInitializePostBack(object sender, ISNet.WebUI.WebGrid.PostbackEventArgs e) { switch (e.Action) { case ISNet.WebUI.WebGrid.PostBackAction.RefreshAll: case ISNet.WebUI.WebGrid.PostBackAction.RefreshData: this.btnCreateReport.Enabled = true; this.grdReports.ClientAction.RenderControl(this.btnCreateReport); Common.Utility.IntersoftHelper.WebGrid.RestoreWebGridScrollPosition(this.grdReports); break; } }
It seems there is an issue in our latest build. I will forward this issue to our developer teams and will let you know the update.For temporary workaround, please try to disable/enable the WebButton from clientside.
Hello,It seems there is an issue in our latest build. I will forward this issue to our developer teams and will let you know the update.For temporary workaround, please try to disable/enable the WebButton from clientside.Regards,Handy
Can you please follow-up when this bug is fixed?
To resolve, I used a combination of server-side code (for initial load) and the Grid's InvokeScript for subsequent grid refreshes. The JavaScript just calls the WebButton's Enable/Disable method. An example:
/// <summary> /// Allow the Adjustment Factor Reports to be executed /// </summary> /// <param name="allowReportsExecute">Flag to indicate if reports can be executed</param> /// <remarks>JavaScript is also used due to Intersoft Bug where the control is not rendered during Fly Postback mode</remarks> private void AllowAdjustmentFactorReportsExecute(bool allowReportsExecute) { this.lbtnCreateAdjustmentFactorReports.Enabled = allowReportsExecute; string jsCode = Common.Utility.CommonHelper.GetJSCode(string.Format("{0}_EnableCreateAdjustmentFactorReportControl({1});", this.ClientID, Common.Utility.CommonHelper.GetJSBoolean(this.lbtnCreateAdjustmentFactorReports.Enabled))); this.grdMasterShell.ClientAction.InvokeScript(jsCode); }
Ok. I have notified this request to our developer teams. I will let you know after I got a response from them.Actually, you don't need the combination server and client. If you used Dexter's workaround, it should work.
Hello,Ok. I have notified this request to our developer teams. I will let you know after I got a response from them.Actually, you don't need the combination server and client. If you used Dexter's workaround, it should work.Regards,Handy
I need to perform this logic on the server side. My work around above works for me.
Can your report back when this issue is resolved? Thank you.
Hi,
There is no workaround for now. I will ask our developer teams when it would be fixed.
Hi,There is no workaround for now. I will ask our developer teams when it would be fixed.Regards,Handy
I provided a work-around above. However, please let me know when the underlying bug is fixed that will allow me not to use javascript to update the button's UI.
Thanks.
Based on discussion with our developer teams, it seems this one is not a bug. WebButton state could not be updated with that way. Also, during the FlyPostBack (refresh), it could not be done. If you want to disable the state, you can use invoke script from server side.By using invoke script, you can call your javascript function to disable the state. Unfortunately, this is the only way. WebButton won't be render the html because the state is disabled due to Invoke script call.
Hello,Based on discussion with our developer teams, it seems this one is not a bug. WebButton state could not be updated with that way. Also, during the FlyPostBack (refresh), it could not be done. If you want to disable the state, you can use invoke script from server side.By using invoke script, you can call your javascript function to disable the state. Unfortunately, this is the only way. WebButton won't be render the html because the state is disabled due to Invoke script call.Regards,Handy
Thanks for your reply. Can you explain this a bit more?
Also, the example that you provided won't work? What's the purpose of the WebGrid's ClientAction's RenderControl method?
Normally, ClientAction is triggered when there is a flypostback action in the control. RenderControl is one of ClientAction method. This method is used to refresh UI control state during postback action.However, Disabling a WebButton doesn’t require rendering at server side during FlyPostBack Request.That's why it returns error when we used RenderControl. You can only do this in FullPostBack or with javascript/client approach.Therefore, If you still want to disable it in server side, you need to use InvokeScript(). This method would call your javascript function.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname