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

TableSearchRow textbox width

3 Answers 90 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Curtis asked on 26 Jul 2018, 08:00 PM

Hello folks!

Is there some way to adjust the width of the textbox in the TableSearchRow?  Also, can a MaxLength be set for this same textbox?

-Curtis

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 27 Jul 2018, 08:53 AM
Hi Curtis,

The following snippet shows how you can access the textbox and set the width:
foreach (var row in this.radGridView1.TableElement.VisualRows)
{
    if (row is GridSearchRowElement)
    {
        var searchRow = row as GridSearchRowElement;
        searchRow.SearchCellElement.SearchBoxWidth = 50;
        break;
    }
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 27 Jul 2018, 09:49 PM

Thank you for the quick reply, Dimitar!

Unfortunately, your approach does not yield the results i was expecting and while i do not know exactly why, i think it's because i am not using a DataBound grid.

this.radGridView1.TableElement.VisualRows.Count = 0

thig.radGridView1.Rows.Count = 527

 

But because i have nothing in VisualRows - i can't seem to find the GridSearchRowElement.

Any thoughts?

-Curtis

 

 

0
Dimitar
Telerik team
answered on 30 Jul 2018, 11:26 AM
Hi Curtis,

You need to make sure that the grid is loaded before using this code, use the OnLoad method for example:
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
 
 
    foreach (var row in this.radGridView1.TableElement.VisualRows)
    {
        if (row is GridSearchRowElement)
        {
            var searchRow = row as GridSearchRowElement;
            searchRow.SearchCellElement.SearchBoxWidth = 50;
            break;
        }
    }
 
}

Let me know how this works for you.

Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Dimitar
Telerik team
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or