Rad Grid Filter - Watermark

6 posts, 0 answers
  1. srinivasskc
    srinivasskc avatar
    12 posts
    Member since:
    Sep 2012

    Posted 14 Sep 2012 Link to this post

    Hi i want a watermark on the filter in the RadGridview.

    How to make water mark as "search" in the filter textbox in RadGrid in asp.net?
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 15 Sep 2012 Link to this post

    Hello,

    Please try with below code snippet.

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridFilteringItem)
           {
               GridFilteringItem filteringItem = e.Item as GridFilteringItem;
               TextBox box = filteringItem["ID"].Controls[0] as TextBox;
               TextBoxWatermarkExtender TextBoxWatermarkExtender1 = new TextBoxWatermarkExtender();
               TextBoxWatermarkExtender1.ID = "txt" + DateTime.Now.Ticks;
               TextBoxWatermarkExtender1.TargetControlID = box.ID;
               TextBoxWatermarkExtender1.WatermarkText = "Search";
               box.Parent.Controls.Add(TextBoxWatermarkExtender1);
           }
       }
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
               OnNeedDataSource="RadGrid1_NeedDataSource"
        AllowFilteringByColumn="true" OnItemCreated="RadGrid1_ItemCreated">
               <MasterTableView>
                   <Columns>
                       <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name">
                       </telerik:GridBoundColumn>
                   </Columns>
               </MasterTableView>
           </telerik:RadGrid>


    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. srinivasskc
    srinivasskc avatar
    12 posts
    Member since:
    Sep 2012

    Posted 14 Nov 2012 Link to this post

    TextBoxWatermarkExtender is a class file. Is it mandatory to use a class file. Is there any other way ? 
    if you have this class file , kindly share with me

    Thanks and regards
    Srini
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Nov 2012 Link to this post

    Hi,

    TextBoxWatermarkExtender is an Ajax Control. You can install the Ajax Control Toolkit and refer the tag prefix in the page.

    Thanks,
    Shinu.
  6. srinivasskc
    srinivasskc avatar
    12 posts
    Member since:
    Sep 2012

    Posted 14 Nov 2012 Link to this post

    thanxx Shinu... i was trying not to use ajax dll bt i guess have no other option. 
    Its  working
  7. Monte
    Monte avatar
    1 posts
    Member since:
    Aug 2012

    Posted 18 Sep 2013 Link to this post

    Use this jQuery plug-in:
    https://code.google.com/p/jquery-watermark/

    Then apply with:
    $(".rgFilterRow input.rgFilterBox").watermark('Search...');
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017