We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add custom placeholder/watermark in textbox on edit or add new row

Thread ID:

Created:

Updated:

Platform:

Replies:

131163 Jun 25,2017 09:24 PM UTC Jun 26,2017 03:07 PM UTC ASP.NET MVC 1
loading
Tags: Grid
Stephen Armstrong
Asked On June 25, 2017 09:24 PM UTC

Hi,

I want to be able to add a placeholder in a textbox when editing or adding a new row in the grid.

Is there a simple way to do this?

Thanks,
Steve

Prasanna Kumar Viswanathan [Syncfusion]
Replied On June 26, 2017 03:07 PM UTC

Hi Steve, 

Thanks for contacting Syncfusion support. 

To add a placeholder in textbox in a row, use actionComplete event of ejGrid. This event will be triggered for every grid success event. In this event we find the input elements of a newly added row and add the placeholder in the textbox. 

Find the code example:  


@(Html.EJ().Grid<object>("HierarchyGrid") 
         .Datasource((IEnumerable<object>)ViewBag.datasource) 
        ---------------------------- 
        .Columns(col => 
        { 
            ----------------------- 
        }) 
        .ClientSideEvents(eve => eve.ActionComplete("complete"))       
) 
 
<script> 
    function complete(args) { 
        if (args.requestType == "add" && args.requestType == "edit") { 
            var textboxes = this.element.find(".gridform").find("input"); 
            for (var i = 0 ; i < textboxes.length ; i++) { 
                $(textboxes[i]).attr("placeholder", "Enter Text"); 
            } 
        } 
    } 
</script> 


Refer to the Help document for the actionComplete event.  


Regards, 
Prasanna Kumar N.S.V 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;