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
Hello,
I would like to create my own CustomEditor, which would be a text box with maxLength set up (the maximum length of the entered text). The maxLength will be different for each row, based on the value of the MaxLength column of the datatable.
I know that there is the TextboxMaxlength property on the WebGridColumn but that sets up the max length same for all the cells in that column.
Some questions:
1) Is there a way how I can set up cell validation or at least the max length manually, per each editable cell?
2) If I create a custom editor as described here http://www.intersoftpt.com/Community/WebGrid/Any-examples-of-Server-control-custom-editors
it requires copying some stuff to C:\Program Files\Intersoft Solutions\WebUI Studio for ASP.NET\CommonLibrary\WebGrid\V7_0_7200\CustomEditors
Since we are deploying to a hosted environment, it is not an option; we will not have access to that folder.
Is there a way how to deploy the custom editor that I create, to a hosted environment?
Thanks in advance!
Hi Andrey,
For conditional of each cell, you can validate in InitializeRow. But you could not validate to choose what edit type you want to use for one cells. You only can set a property or a value for one cell.
if(e.Row.Cells[0].Text=="1"){ changed to text1}else could not assign 2 edit type into one cell or { column changed to text2}
if(e.Row.Cells[0].Text=="1"){ changed to text1
}else could not assign 2 edit type into one cell or { column changed to text2}
e.g If your custom editor has a maxlength properties, you can try to validate like the code below.Only can assign one edit type. But you can customize the length
if (e.Row.Cells[0].Text == "1") { MyTextBox.MaxLength= (fill your size) ; }
Once again I need to remind you, Our WebGrid supports Custom Editor from another control. But the validation or the feature that you wanted custom editor to show, depends on custom editor itself. E.g You have custom editor textbox. If you want the textbox to show multiline, the textbox itself should have own the feature. The validation inside those custom editors also need to be customized by your own because we don't know exactly what custom editor that our customers have because it's their own control.Unfortunately, ResizableTextBox is a DHTML control/client. We could not validate the length at InitializeRow. If you want to customize it and add onKeydown event, I suggested you to use add Listener.
Normally, to add an event in an object, You will need to get the element of object and Listener on it.
e.g Below is snippet codes which I used to attach event onmouseover and onmouseout on WebGrid column header.
function window::onload() { var grid=ISGetObject("WebGrid1"); var el=grid.RootTable.GetElement(WG40.COLHEADER, WG40.HTMLDIV); var el1=grid.RootTable.GetElement(WG40.BODY, WG40.HTMLTABLE) Listener.Add( el, "onmouseover", test); Listener.Add(el, "onmouseout",test1); Listener.Add( el1, "onmouseover", test2); Listener.Add(el1, "onmouseout",test3); } function test() { alert("onmouseover is called"); } function test1() { alert("onmouseout is called"); } function test2() { alert("onmouseover is called"); } function test3() { alert("onmouseout is called"); }
Hope this helps.
Regards,Handy
It seems the scenario is possible to do. Please try to validate it at OnIntializeRow event. You can set any validation of your cells within a row.
About the last questions, using your own custom editor, requires CommonLibrary which I have showed you on another thread. In deployment environment, you can also copy the folder and set as virtual directory. So, all the necessary scripts, should be able to access. Does in hosted environment, allow developer also to create a virtual directory in (IIS/localhost)?
Hi Handy,
Thanks for your answer.
Regarding the validation, I still do not see a way, how to set it up. In the InitializeRow handler (you did mean the server handler, right?), I can access the e.Row.Cells collection - but that only gives me access to objects of WebGridCell. I need to set up the max length on the textbox, which is not part of the WebGridCell. Am I missing something here?
I guess I will have to write my own custom editor. What we need here is a multiline text (=textarea), which has an onkeydown script (or similar) that checks the length.
Is there a way, how I can reuse an already existing editor - in our case MultilineText? I mean to create a custom editor, which will derive the already existing behavior of the multiline text.
The client code is all obfuscated, which makes it useless as sample code, and your documentation does not contain any samples on that. I checked the referenced sample but there is no sample how to create a pure DHTMLClientControl - would you have any to share here?
Thanks!
Your requirement is customize the length of textbox to be multiline, isn't it? If that so, I think you could not customize it except, the textbox is already a multiline textbox control.
If I am not mistaken, html and asp.net textbox also could not be customized into multiline textbox. If user needs multiline, he must to use multiline textbox control.
So, I think you need to integrate multiline textbox from beginning instead of normal textbox.
If you read my previous question again, I know that I need to use the MultilineText (=text area). Could you please answer the questions that I asked there?
1) How to set up the associated editor (in this case the MultilineText) for one particular cell (not column) during InitializeRow as you suggested in your first reply?
2) If I want to write my own custom editor, can I base it on (=derive from) your already existing editor called MultiLine? If so, how do I do that?
Thanks.
Hi,
I am sorry but you missunderstood my point.
At first reply, I assume you only wanted to customize the length, not multiline.
As I said at my previous post, you could not customize your textbox into multiline except if you are using textbox for multiline.
e.g In asp.net/html control, there are two types of textboxes. Normal textbox and Textbox for multiline.Normal textbox could not be customized into Multiline. That's already the behaviour.
If you need a multiline as your custom editor, you can use ResizeableTextBox (DHTML>>Client side) or use WebInput and WebTextEditor (server side control). Those controls could be customized into multiline.
I am afraid that you misunderstood my point and besides, you still have not answered my questions.
It is true that we need a multiline text in this particular scenario but we need to be able to use some kind of client side validation in general, with any edit types. To do so, I need to access the editor and customize it somehow (e.g. attach onkeydown hanlders, etc.)
You wrote:"Please try to validate it at OnIntializeRow event. You can set any validation of your cells within a row."and my question was "1) How to set up the associated editor (in this case the MultilineText) for one particular cell (not column) during InitializeRow as you suggested in your first reply?"
Could please answer my question and elaborate more on how to access the WebGrid cell editor during the OnInitializeRow event, and how to set up any kind of validation?
Furthermore, even if we use the ResizeableTextBox as you recommended, we still need to enforce the max length. Could you please recommend, how to achieve that?
I know that there is no maxlength property of the multiline text box but it would be enough to include some kind of onkeydown='someHandler()'. Unfortunately, I do not know how to add the onkeydown to the ResizableTextBox. Would you know how to do that?
Rgds.
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