
Hi
I am trying to count number of columns and column values from a table but everytime I am getting wrong values.
Please check below for the Object Property:
Object Property
<table rules="all" cellspacing="0" cellpadding="3" border="1" style="border-collapse: collapse;" columncount="10" expandedclientidsname="HierarGrid_ExpandedIDs_ResultsGrid_ctl06" class="Datagrid">
Code:
Dim t As HtmlTable = myManager.ActiveBrowser.Find.ByExpression(Of HtmlTable)("class=Datagrid")
Dim Rowcounts As Integer = t.Rows.Count
Dim ColumnCount As Integer = t.ColumnCount()
Row Count is working properly but Column Count is not working properly.
I am using above code to find the number of columns but instead of returning 10 it is returning 2. So please tell me the solution.
Do let me know if I am doing anything wrong.
5 Answers, 1 is accepted
Thanks for the post and question, and your trial of WebUI Test Studio.
From what I've researched on WC3's site and after talking to my boss, the 'columncount' attribute typically is not associated with the table tag or table element.
I ran a reproduction with the html and test code you posted in each of the supported browsers, and all of them interpreted the code the same and returned the came column number of 2, even with columncount = 10.
Was this attribute generated via a RadControl implementation or some other type Ajax html code generation?
Regards,
Nelson
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

So do let me know if any workaround is there to resolve this issue.
~Thanks
So there really isn't a work around for this as that property is only populated by what the playback brower reports from it's translation of the html.
If you wanted to check for that attribute, you can access it via:
Dim a As iAttribute = t.Attributes(5)
Best wishes,
Nelson
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

Incase of RadControl implementation ,what could be the workaround?
Some of the features of our application has 'RadControl implementation '.
~Thanks
Ajit Kumar
So a GridTableView/HtmlTable is the same implementation and you'll get the same column count as the code you posted. Here is a coded example where the code will return 6 as expected for the demo page:
<TestMethod()> _
Public
Sub
SampleWebAiiTestVB()
' Launch a browser instance
Manager.LaunchNewBrowser(BrowserType.InternetExplorer)
' The active browser
ActiveBrowser.NavigateTo(
"http://demos.telerik.com/aspnet-ajax/grid/examples/performance/linq/defaultcs.aspx"
)
' Find the google search box and set it to "ArtOfTest";
Dim
n
As
Integer
= Find.ByExpression(Of HtmlTable)(
"id=RadGrid1_ctl00"
,
"tagname=table"
).ColumnCount
End
Sub
Sincerely,
Nelson
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.