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
Hi,
When we mark column(having column edit type as dropdownlist EditType = EditType.DropdownList;) as
readonly, then datavalue field is shown.
how to make when column makred as readonly then datatext field show of doropdownlist not datavalue field?
Please reply ASAP.
Regards
Sachin Jain
I started my investigation by modifying BindWebValueListtoISDataSource.aspx sample file of WebGrid. The live version of this sample is in here.
The SupplierID and CategoryID column of the sample are having column edit type as DropdownList. I tested the reported problem by using following approach:
Set column's EditType to NoEdit using OnInitializeColumn server-side event.
OnInitializeColumn server-side event is invoked when WebGridColumn needs to be initialized during data binding. Following snippet code is used to set the column as read-only.
protected void WebGrid1_InitializeColumn(object sender, ColumnEventArgs e) { if (e.Column.Name == "SupplierID" || e.Column.Name=="CategoryID") { e.Column.EditType = EditType.NoEdit; } }
Result: column shows datatext field of dropdownlist.
Set cell's ForceNoEdit to true using OnInitializeRow server-side event.
OnInitializeRow server-side event is invoked when a WebGridRow need to initialized during data binding. Following snippet code is used to set the cell as read-only.
protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e) { if (e.Row.Type==RowType.Record) { if (e.Row.KeyValue.ToString() == "1") { e.Row.Cells.GetNamedItem("SupplierID").ForceNoEdit = true; e.Row.Cells.GetNamedItem("CategoryID").ForceNoEdit = true; } } }
Set columns's EditType to NoEdit using JavaScript function.
Following snippet code is used to set the column's EditType to NoEdit.
function ToggleColumnEdit() { // retrieves WebGrid's object var grid = ISGetObject("WebGrid1"); // access WebGrid's RootTable var rootTable = grid.RootTable; var columnSupplierID = rootTable.GetColumn("SupplierID"); var columnCategoryID = rootTable.GetColumn("CategoryID"); columnSupplierID.EditType = "NoEdit"; columnCategoryID.EditType = "NoEdit"; return true; }
Invoke SetForceNoEdit(true) of the cell using JavaScript function.
Following snippet code is used to set the cell to read-only.
function ToggleNewRowEdit() { // retrieves WebGrid's object var grid = ISGetObject("WebGrid1"); // retrieves first row object var firstRow = grid.RootTable.GetRow(0); firstRow.GetCell("SupplierID").SetForceNoEdit(true); firstRow.GetCell("CategoryID").SetForceNoEdit(true); return true; }
I was unable to reproduce the reported problem using these techniques.
When we mark column(having column edit type as dropdownlist EditType = EditType.DropdownList;) as readonly, then datavalue field is shown.
I would need you to elaborate on your specific scenario and possibly give me a running simple sample of WebGrid and step-by-step guide that I can use to observe the problem.
Thanks for the reply
I used client side to make column readonly with following code given by you:
function ToggleColumnEdit() { // retrieves WebGrid's object var grid = ISGetObject("WebGrid1"); // access WebGrid's RootTable var rootTable = grid.RootTable; var columnSupplierID = rootTable.GetColumn("SupplierID"); var columnCategoryID = rootTable.GetColumn("CategoryID"); columnSupplierID.EditType = "NoEdit"; columnCategoryID.EditType = "NoEdit"; return true;}
Coule please give us solution ASAP, Please?
Thank you for the sent sample. I can reproduce the reported problem using the sample.
I’m currently still investigating this issue and need more time to provide you with solution, suggestion, or sample.
I’ll get back to you as soon as possible.
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