Hi,
I have a Radgrid connected to an entitydatasource with a select button, the selected row is changed and highlighted when the row is clicked. However, when the select button is clicked the selected row is changed but the highlighting does not, it only changes when the row is clicked.
I need the selected row to be highlighted when either the row is clicked or the select button is clicked.
I am new to Telerik software, can anyone point me in the right direction.
Regards
Dave
I have a Radgrid connected to an entitydatasource with a select button, the selected row is changed and highlighted when the row is clicked. However, when the select button is clicked the selected row is changed but the highlighting does not, it only changes when the row is clicked.
I need the selected row to be highlighted when either the row is clicked or the select button is clicked.
I am new to Telerik software, can anyone point me in the right direction.
Regards
Dave
4 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 10 Dec 2010, 07:06 AM
Hello Dave,
I think you might not set the commandName property (CommandName="Select") for that button.
MarkUp:
Thanks,
Princy.
I think you might not set the commandName property (CommandName="Select") for that button.
MarkUp:
<
telerik:GridButtonColumn
CommandName
=
"Select"
HeaderText
=
"Select"
UniqueName
=
"Select"
Text
=
"Select"
>
Thanks,
Princy.
0

Dave
Top achievements
Rank 1
answered on 11 Dec 2010, 06:31 PM
Hi Princy,
Thank you for your response, your solution works (I will be marking it as the answer) but I have three command buttons on the row how can I have them work as select buttons but trigger different pieces of code? Here is a copy of code I used when I had GridView controls, I am trying to replace with Radgrid. If I change the CommandName property to anything other than "select" I lose the highlighting.
protected void gvAirports_ItemCommand(object sender, GridCommandEventArgs e)
{
switch (e.CommandName.ToLower())
{
case "details":
gvAirports.SelectedIndex = Convert.ToInt32(e.CommandArgument);
mvAirportDetails.ActiveViewIndex = 0;
break;
case "contractedsuppliers":
gvAirports.SelectedIndex = Convert.ToInt32(e.CommandArgument);
mvAirportDetails.ActiveViewIndex = 1;
mvContractedSuppliers.ActiveViewIndex = -1;
break;
case "noncontractedsuppliers":
gvAirports.SelectedIndex = Convert.ToInt32(e.CommandArgument);
mvAirportDetails.ActiveViewIndex = 2;
mvNonContractedSuppliers.ActiveViewIndex = -1;
break;
default:
break;
}
}
Thank you in advance for your time.
Regards
Dave
Thank you for your response, your solution works (I will be marking it as the answer) but I have three command buttons on the row how can I have them work as select buttons but trigger different pieces of code? Here is a copy of code I used when I had GridView controls, I am trying to replace with Radgrid. If I change the CommandName property to anything other than "select" I lose the highlighting.
protected void gvAirports_ItemCommand(object sender, GridCommandEventArgs e)
{
switch (e.CommandName.ToLower())
{
case "details":
gvAirports.SelectedIndex = Convert.ToInt32(e.CommandArgument);
mvAirportDetails.ActiveViewIndex = 0;
break;
case "contractedsuppliers":
gvAirports.SelectedIndex = Convert.ToInt32(e.CommandArgument);
mvAirportDetails.ActiveViewIndex = 1;
mvContractedSuppliers.ActiveViewIndex = -1;
break;
case "noncontractedsuppliers":
gvAirports.SelectedIndex = Convert.ToInt32(e.CommandArgument);
mvAirportDetails.ActiveViewIndex = 2;
mvNonContractedSuppliers.ActiveViewIndex = -1;
break;
default:
break;
}
}
Thank you in advance for your time.
Regards
Dave
0
Accepted

Princy
Top achievements
Rank 2
answered on 13 Dec 2010, 07:13 AM
Hello Dave,
One suggestion is to use different CommandName for each button and select the Row explicitly from code behind while clicking the button.Here is the sample code.
C#:
Thanks,
Princy.
One suggestion is to use different CommandName for each button and select the Row explicitly from code behind while clicking the button.Here is the sample code.
C#:
protected
void
RadGrid1_ItemCommand(
object
source, Telerik.Web.UI.GridCommandEventArgs e)
{
switch
(e.CommandName)
{
case
"details"
:
e.Item.Selected =
true
;
//your code
}
}
Thanks,
Princy.
0

Dave
Top achievements
Rank 1
answered on 13 Dec 2010, 09:47 PM
Hi Princy,
Thank you so much for your help, that works!
Regards and holiday greetings!
Dave
Thank you so much for your help, that works!
Regards and holiday greetings!
Dave