473,499 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview selectedrowstyle-backcolor does not work when buttons selected??

I can't seem to get selectedrowstyle-backcolor to set the row
background color unless I force the selected index in the code behind.
When i select the ButtonField Run button it does set the background
color for the row. Is there another property I need to set to allow
selection for this to work?

</div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
SelectedRowStyle-BackColor="lightcoral">
<Columns>

<asp:ButtonField Text="run" ButtonType="Button"
CommandName="run" />
<asp:CommandField ShowEditButton="True"
ShowDeleteButton="True"/>

Thanks for any help or information!

Feb 9 '07 #1
1 8038
Following up on my own question.. I see there is a showselectcommand
that does work, but I'm trying to do several things here. I need to
select and highlight the row when select by another button that does
stuff, and I've had to place that button under a TemplateField because
I need evalutate bound data to determine whether to enable or not..
could not figure out how to do that under a buttonfield since it has
no enabled property nor does it allow bind or eval..

<asp:GridView SkinID="gridview" ID="rungridview" runat="server"
AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
SelectedRowStyle-BackColor="yellow"
DataSourceID="gridviewdatasource" DataKeyNames="Jobname">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Run" SkinID="Button" Text="Run"
CommandArgument='<%#Eval("Jobname") %>'
Enabled='<%# Eval("Enabled")%>'
CommandName="Run" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Schedule" HeaderText="Schedule"
SortExpression="Schedule" />

Also, wondering .. in the codebehind, under the rowcommand event, is
there any way that I get the index of the row for which the command
was selected? If so, i could then simply

Protected Sub PendingGridView_RowCommand(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles
rungridview.RowCommand
....
rungridview.SelectedIndex = whaterver

Thanks again.

Feb 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5656
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
6
3019
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
4
9767
by: ber.janssens | last post by:
Hi, In ASP.NET 2.0, I have a GridView with 2 CommandFields, how can I determine in the SelectedIndexChanged event which CommandField is clicked? <asp:GridView ID="gvOrderList" runat="server"...
5
15264
by: Brian McClellan | last post by:
Just wondering if anyone has a simple example of creating a gridview completely programmatically, i'm not doing anything terribly sophisticated. When creating the gridview declaratively evertying...
7
5370
by: GaryDean | last post by:
I'm trying to load a GridView up with data manually, in code. I'm not using any datasource. Using this code.... ArrayList myRowArrayList; GridViewRow myGVR = new...
0
4300
by: Elmo Watson | last post by:
OK - main gridview - gvTV In one column - I have another Gridview - gvTRPTV - function: Public Function AddTRPRow() As DataTable dtHeader = CType(ViewState("Header"), DataTable) If dtHeader...
1
2160
by: syl | last post by:
Hello I am trying to create a "easy to use" gridview with filters (dropdownlist in headers), sorting...and much more.... In order to do that, i prefer to use a objectdatasource (ODS) beacause...
0
2433
by: lightgram | last post by:
Hello I am having problems extracting the OldValues collection from the RowUpdating event in my GridView. Every time I access this I am getting the values from the NewValues collection in...
6
5728
by: RobertTheProgrammer | last post by:
Hi folks, Here's a weird problem... I have a nested GridView setup (i.e. a GridView within a GridView), and within the nested GridView I have a DropDownList item which has the...
5
6060
by: Eric | last post by:
Hi, there are several gridviews all with a linkbutton which all trigger the same procedure. I need to know from which gridview the linkbutton has been clicked. Thanks Eric Here the code:
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.