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
in webgrid PrepareDataBinding event(WebGrid version is 6.0.7200.220),
if (grid.IsFlyPostBack) { string hid_type = Request.Form["hid_type"]; if (string.IsNullOrEmpty(hid_type)) hid_type = "0"; if (hid_type == "0") { grid.RootTable.Columns.GetNamedItem("f_code").Caption = "ISBN Code"; } else { grid.RootTable.Columns.GetNamedItem("f_code").Caption = "Book Code"; } }
client code is
function ViewByType(type, thisControl) { var grid = ISGetObject("grid"); document.all["hid_type"].value = type; thisControl.className = "HoverLinkSelected"; if (type == '0') { document.getElementById("type_criterion").className = "HoverLinkNormalFontSize"; } else { document.getElementById("type_book").className = "HoverLinkNormalFontSize"; } grid.Refresh(); }
server code run ok, but in page, the caption not change, why?
thanks
Hi Roger,
It is impossible to change the header columns in prepareDataBinding Event like that. WebGrid could read the code but cannot render it.To change header column, I suggest you to set the inner text in column only on client side. You can remove your WebGrid PrepareDataBinding Event, and then change the client side code with this following code:
function ViewByType(type, thisControl) { var grid = ISGetObject("grid"); document.all["hid_type"].value = type; thisControl.className = "HoverLinkSelected"; if (type == '0') { document.getElementById("type_criterion").className = "HoverLinkNormalFontSize"; // add this code to changes header column grid.RootTable.Columns.GetNamedItem("CategoryID").GetElement(WG40.COLHEADER, WG 40.HTMLDIV).parentNode.childNodes[1].innerText = "ISBN Code"; } else { document.getElementById("type_book").className = "HoverLinkNormalFontSize"; // add this code to changes header column grid.RootTable.Columns.GetNamedItem("CategoryID").GetElement(WG40.COLHEADER, WG 40.HTMLDIV).parentNode.childNodes[1].innerText = "Book Code"; } //remove this method //grid.Refresh(); }
// add this code to changes header column grid.RootTable.Columns.GetNamedItem("CategoryID").GetElement(WG40.COLHEADER, WG 40.HTMLDIV).parentNode.childNodes[1].innerText = "Book Code";
Hope this helps.Riendy
Hello Roger,
Sorry, I missed something there. The header column has changes, but there is not the right element to changed. Could you please change the codes bellow :
grid.RootTable.Columns.GetNamedItem("CategoryID").GetElement(WG40.COLHEADER, WG 40.HTMLDIV).parentNode.childNodes[1].innerText = "Book Code";
to :
var table = grid.RootTable; var column= table.GetElement(WG40.COLHEADER, WG40.HTMLTABLE).childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0]; column.innerText = "Book Code";
It runs perfectly on my end. Please do not hesitate to let me know if you find another issue or question.Thank you.Riendy
Thank you, Riendy, after used
, but sort function do not work?
Thanks
var table = grid.RootTable; var column= table.GetElement(WG40.COLHEADER, WG40.HTMLTABLE).childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0]; -- Remove underline code,it can work。 column.innerText = "Book Code";
Thank you.
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