vs2005 - winforms - ultragrid
I have a situation where I am trying to capture the row number on the row that is being expanded. When I click on the "+" to expand the child rows, the currentrow returns what row was physically selected, not the row that I am trying to expand. I am trying to capture the current row on the AfterRowExpanded event.
Any help would be fantastic.
Thanks in advance.
Wayne
The event does pass e.row etc but I have not found how to capture the row that you are expanding. You seem to have to select the row then the "+" to beable to capture the current row. My problem is that the users are pressing the "+" without selecting the row. Pressing the "+" expands correctly, but in code I am trying to capture the row number that is being expanded (parent)
I have tried about every code avenue and knowledge base on this subject, but still am coming up empty handed. You are the first to respond to my problem
Hope that makes sense.
Wayne.
Hi Wayne,
One of us is very confused.
If you trap the AfterRowExpanded event and examine e.Row, this should return the row that is being expanded. This may or may not be the active row.
Well there lies the confusion. On the expanded row if I try to capture the row number, it only gives me the row that was last selected, not the current one.
For example:
I select a row in the grid. I can capture that row number (Row 3 for example). Now when I select the "+" on another row (not row 3) to expand the child rows, and in the event of AfterRowExpanded I try to capture the row number (of that parent row), I get returned Row 3. It is like I have to select a row for it to return the row number. By why can't I capture the correct row number on a row that I only press on the "+" ?
....
Me.grdAllProposals.Rows(Me.grdAllProposals.ActiveRow.RowSelectorNumber)
.....
It's not working because you are using the ActiveRow property and not e.Row.
The line of code you have here doesn't make any sense. You are using the RowSelectorNumber as an index into the Rows collection of the grid to get a reference to a row that you already have.
If you want to get a reference to the row, you can just use e.Row. You don't need to use the row number.
I have to go on record and say that there is a bug on retreiving the current row information in the AfterRowExpanded method. If you press on the "+" on a parent row that is not selected (row selector active), you will not get the row information on the row you pressed the "+".
The only way that I am able to get the row information I am looking for is by pressing on the row (row selector) then pressing on the "+" to expand the child rows. I feel this is a bug because the when expanding the child rows on a parent row that function works great, but I can't get the parent row information unless I select the parent row (row selector).
This is driving me nuts. I would like to think that I am doing something wrong with my code, but I have tried everyway I know how to discount it.
I will provide whatever necessary to show you what I am doing to get the results that I am. I'm very confident that you will get the same results that I am putting in place code to view the parent row information.
I'm not sure what else to tell you. I just tested this out and it works fine for me.
Are you saying that e.Row is returning the wrong row?
e.Row is always returning the Index a 0 (Zero). Please help me.
I am sorry. Thanks for your valuable support.
Hi,
This forums is for UltraWinGrid. I'm afraid I know nothing about UltraWebGrid. You should post your question on the UltraWebGrid forum.
Thanks for your reply. Below is the code that I have used in my project
Design Code:
<igtbl:UltraWebGrid ID="uwg_Test" runat="server" ImageDirectory="/ig_common/Images/"
Style="z-index: 123; left: 500px; position: absolute; top: 240px; width: 340px;"
TabIndex="4" >
<DisplayLayout AutoGenerateColumns="False" BorderCollapseDefault="Separate" ColFootersVisibleDefault="Yes"
Name="uwgxTest" RowHeightDefault="10px" SelectTypeRowDefault="Single"
TableLayout="Auto" Version="2.00" ViewType="Hierarchical">
<AddNewBox Hidden="False">
<style backcolor="LightGray" borderstyle="Solid" borderwidth="1px">
</style>
<BoxStyle BackColor="LightGray" BorderWidth="1px" BorderStyle="Solid">
</BoxStyle>
</AddNewBox>
<Pager>
<PagerStyle BackColor="LightGray" BorderWidth="1px" BorderStyle="Solid"></PagerStyle>
</Pager>
<HeaderStyleDefault BackColor="#4646FF" BorderColor="Black" BorderStyle="Solid" Font-Bold="True"
Font-Names="Arial" Font-Size="10pt" ForeColor="White" HorizontalAlign="Center">
<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
</HeaderStyleDefault>
<FrameStyle BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" Cursor="Default"
Font-Names="Verdana" Font-Size="8pt" Height="75px" Width="345px">
</FrameStyle>
<FooterStyleDefault BackColor="#4646FF" BorderStyle="Solid" BorderWidth="1px" Font-Names="Arial"
Font-Size="10pt" ForeColor="White" HorizontalAlign="Left">
</FooterStyleDefault>
<EditCellStyleDefault BackColor="White" BorderStyle="None" BorderWidth="0px" ForeColor="Red"
VerticalAlign="Top">
</EditCellStyleDefault>
<SelectedRowStyleDefault BackColor="Black" ForeColor="White">
</SelectedRowStyleDefault>
<Images ImageDirectory="/ig_common/Images/">
</Images>
<RowAlternateStyleDefault BackColor="#6262FF" Font-Names="Arial" Font-Size="10pt"
ForeColor="White" HorizontalAlign="Left">
</RowAlternateStyleDefault>
<RowStyleDefault BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Arial" Font-Size="10pt" ForeColor="Black">
<Padding Left="3px" />
<BorderDetails ColorLeft="Gray" ColorTop="Gray" WidthLeft="0px" WidthTop="0px" />
</RowStyleDefault>
<ActivationObject BorderColor="" BorderWidth="">
</ActivationObject>
</DisplayLayout>
<Bands>
<igtbl:UltraGridBand>
<Columns>
<igtbl:UltraGridColumn BaseColumnName="ID" Hidden="True" Key="ID"
Width="0px">
<Footer Key="ID">
</Footer>
<Header Key="ID">
</Header>
</igtbl:UltraGridColumn>
<igtbl:UltraGridColumn BaseColumnName="Year" HeaderText="Year" Key="Year"
Width="75px">
<Footer Key="Year">
<RowLayoutColumnInfo OriginX="1" />
<Header Caption="Year" Key="Year">
<igtbl:UltraGridColumn BaseColumnName="StatusCode" HeaderText="Status"
Key="StatusCode" Type="Custom" Width="273px">
<Footer Key="StatusCode">
<RowLayoutColumnInfo OriginX="2" />
<Header Caption="Status" Key="StatusCode">
<igtbl:UltraGridColumn BaseColumnName="AgreementID" HeaderText="Agreement ID"
Hidden="True" Key="AgreementID" Width="0px">
<Footer Key="AgreementID">
<RowLayoutColumnInfo OriginX="3" />
<Header Caption="Agreement ID" Key="AgreementID">
</Columns>
<AddNewRow Visible="NotSet" View="NotSet">
</AddNewRow>
</igtbl:UltraGridBand>
</Bands>
</igtbl:UltraWebGrid>
Code Behind:
Protected Sub uwg_Test_UpdateRowBatch(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles uwg_Test.UpdateRowBatch
Dim Index As Integer
Index = e.Row.Index
End Sub
The Index is returnig as 0(Zero) even if update row 1, 2 , 3 and go on… So If I update a record for the row 2 or 3, its getting updated in row 0
If you can post a sample project demonstrating this, I would be happy to take a look at it. But without seeing the behavior, there is no reason I can think of why this would occur.