This is a migrated thread and some comments may be shown as answers.

Rad Grid Filter - Watermark

5 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
srinivasskc
Top achievements
Rank 1
srinivasskc asked on 14 Sep 2012, 06:16 PM
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?

5 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 15 Sep 2012, 05:18 AM
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
0
srinivasskc
Top achievements
Rank 1
answered on 15 Nov 2012, 05:04 AM
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
0
Shinu
Top achievements
Rank 1
answered on 15 Nov 2012, 05:25 AM
Hi,

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

Thanks,
Shinu.
0
srinivasskc
Top achievements
Rank 1
answered on 15 Nov 2012, 05:55 AM
thanxx Shinu... i was trying not to use ajax dll bt i guess have no other option. 
Its  working
0
Monte
Top achievements
Rank 1
answered on 18 Sep 2013, 06:30 PM
Use this jQuery plug-in:
https://code.google.com/p/jquery-watermark/

Then apply with:
$(".rgFilterRow input.rgFilterBox").watermark('Search...');
Tags
Grid
Asked by
srinivasskc
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
srinivasskc
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Monte
Top achievements
Rank 1
Share this question
or