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

Problem with Filter buttons/GridButtonColumn

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 13 Jan 2011, 01:47 AM
Hi Guys,

I am using a radgrid with two GridButton Columns and Filtering by column enabled. I tried to add an attribute "onclick" to one of the button columns in the following way in the RadGrid DataBound event
Button button = radGridItem["Create"].Controls[0] as Button;
button.Attributes["onclick"] = "form1.target = '_blank';";

I did this so that once the user clicks on the button (of the column with UniqueName= "Create"), he can be redirected to another page in another window.

Now the PROBLEM is , both the button column buttons AND the Filter buttons in the header when clicked open the page in a new window.

How do I  add the above attribute to only one Button Column?(and not to other buttons and Filter buttons)

Please help!!!!

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 18 Jan 2011, 09:21 AM
Hello Nick,

Can you specify for which grid items are you calling the preceding code? Calling if only for the items of type GridDataItem should not result in the described behavior, but only the buttons in the grid items should open a new window:

foreach(GridDataItem radGridItem in RadGrid1.MasterTableView.Items)
{
    Button button = radGridItem["Create"].Controls[0] as Button;
    button.Attributes["onclick"] = "form1.target = '_blank';";
}


Greetings,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Nick
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or