changing name on Select button - DOTNET
This is a discussion on changing name on Select button - DOTNET ; I have a gridview that has a left column that displays 'Select' for selecting
the row. I have the followng code that will select/deselect the row when the
'Select' is used. What is being asked for is to have 'Select' ...
-
changing name on Select button
I have a gridview that has a left column that displays 'Select' for selecting
the row. I have the followng code that will select/deselect the row when the
'Select' is used. What is being asked for is to have 'Select' change to
'Unselect' (or Deselect) when the row is highlighted. How would that be
place in the code that is currently being used?
protected void GridView1_SelectedIndexChanging(object sender,
GridViewSelectEventArgs e)
{
if (GridView1.SelectedIndex == e.NewSelectedIndex)
{
e.Cancel = true;
GridView1.SelectedIndex = -1;
}
}
Thanks for the assistance.
John
-
Re: changing name on Select button
On 27 Aug, 00:16, JohnE <Jo...atdiscussionsdotmicrosoft.com> wrote:
> I have a gridview that has a left column that displays 'Select' for selecting
> the row. I have the followng code that will select/deselect the row when the
> 'Select' is used. What is being asked for is to have 'Select' change to
> 'Unselect' (or Deselect) when the row is highlighted. How would that be
> place in the code that is currently being used?
>
> protected void GridView1_SelectedIndexChanging(object sender,
> GridViewSelectEventArgs e)
> {
> if (GridView1.SelectedIndex == e.NewSelectedIndex)
> {
> e.Cancel = true;
> GridView1.SelectedIndex = -1;
> }
> }
>
> Thanks for the assistance.
> John
GridView doesn't support multiple selection. Either one row is
selected or none are selected. Your code already represents the most
that can be achieved.
-
Re: changing name on Select button
"Stan" wrote:
> On 27 Aug, 00:16, JohnE <Jo...atdiscussionsdotmicrosoft.com> wrote:
> > I have a gridview that has a left column that displays 'Select' for selecting
> > the row. I have the followng code that will select/deselect the row when the
> > 'Select' is used. What is being asked for is to have 'Select' change to
> > 'Unselect' (or Deselect) when the row is highlighted. How would that be
> > place in the code that is currently being used?
> >
> > protected void GridView1_SelectedIndexChanging(object sender,
> > GridViewSelectEventArgs e)
> > {
> > if (GridView1.SelectedIndex == e.NewSelectedIndex)
> > {
> > e.Cancel = true;
> > GridView1.SelectedIndex = -1;
> > }
> > }
> >
> > Thanks for the assistance.
> > John
>
> GridView doesn't support multiple selection. Either one row is
> selected or none are selected. Your code already represents the most
> that can be achieved.
>
I didn't ask for a multiple select. When someone selects a row using the
Select command on the left side of the gridview, the text name should change
to 'Unselect' so the user knows how to un-select the row. The code here does
the select / unselect of a row but does not change the text name (or
commandname). That is what I am looking for.
-
Re: changing name on Select button
I've only used ListView and I was able to accomplish something simular with
the FindControl Property
Not sure, but I'm wondering if something like this might point you in the
right direction in discovering your solution?
protected void GridView1_SelectedIndexChanging(object sender,
GridViewSelectEventArgs e)
{
if (GridView1.SelectedIndex == e.NewSelectedIndex)
{
e.Cancel = true;
GridView1.SelectedIndex = -1;
Label l;
l = (Button) e.Item.FindControl("SelectButton");
if(!(l == null) ){
l.Text="Selected";}
}
}
"JohnE" <JohnEatdiscussionsdotmicrosoft.com> wrote in message
news:06F11077-33CD-4909-BD61-68A0C04A3713atmicrosoftdotcom...
>
>
> "Stan" wrote:
>
>> On 27 Aug, 00:16, JohnE <Jo...atdiscussionsdotmicrosoft.com> wrote:
>> > I have a gridview that has a left column that displays 'Select' for
>> > selecting
>> > the row. I have the followng code that will select/deselect the row
>> > when the
>> > 'Select' is used. What is being asked for is to have 'Select' change
>> > to
>> > 'Unselect' (or Deselect) when the row is highlighted. How would that
>> > be
>> > place in the code that is currently being used?
>> >
>> > protected void GridView1_SelectedIndexChanging(object sender,
>> > GridViewSelectEventArgs e)
>> > {
>> > if (GridView1.SelectedIndex == e.NewSelectedIndex)
>> > {
>> > e.Cancel = true;
>> > GridView1.SelectedIndex = -1;
>> > }
>> > }
>> >
>> > Thanks for the assistance.
>> > John
>>
>> GridView doesn't support multiple selection. Either one row is
>> selected or none are selected. Your code already represents the most
>> that can be achieved.
>>
>
> I didn't ask for a multiple select. When someone selects a row using the
> Select command on the left side of the gridview, the text name should
> change
> to 'Unselect' so the user knows how to un-select the row. The code here
> does
> the select / unselect of a row but does not change the text name (or
> commandname). That is what I am looking for.
>