What object do your developer use? If you use stand alone object inasp.net, you 
can give an ID to it. But if you use an object inside ancontainer like  
DataGrid,DataList, Repeater or GridView( Asp.Net 2.0).Asp.Net automatically 
gives and ID to them since an ID in a html pagemust be unique. For example you 
have such a declaration in aspx page.
                <asp:GridView " ID="ctlDataGrid" runat="server"                 
    AutoGenerateColumns="False"EnableViewState="False" Width="100%" 
CssClass="Grid">                    <Columns>                        
<asp:TemplateField>                            <ItemTemplate>                   
             <asp:Label ID="lblName" runat="server"Text='<%# 
DataBinder.Eval(Container, "DataItem.Name") %>'></asp:Label>                    
        </ItemTemplate>                        </asp:TemplateField>             
       </Columns>                </asp:GridView>                this asp.net 
template render in html as below.                                               
 <table id="ctl00_cphAnaIcerikPaneli_ctlDataGrid" >                    <tr>     
                   <td align="left">                            
<spanid="ctl00_cphAnaIcerikPaneli_ctlDataGrid_ctl02_lblName">İMAM HATİPLİSESİ 
VE ANADOLU İ.H.L. </span>                        </td>                    </tr> 
            !
       <tr >                        <td align="left">                           
 <spanid="ctl00_cphAnaIcerikPaneli_ctlDataGrid_ctl03_lblName">AnafartalarLisesi 
</span>                        </td                    </tr>                    
                </table>
note that your lblName id in label rendered as span as asp.net rendersasp:label 
as span and it renames your id="lblName" 
asctl00_cphAnaIcerikPaneli_ctlDataGrid_ctl03_lblName
cphAnaIcerikPaneli this comes beacuse of SkinID which comes with Asp.Net 2.0 
ctlDataGrid this is what you give an id to your datagrid or gridview object.at 
last lblName this is your developer id. As you see there is a pattern inthis 
renaming of IDs.
you can catch these as ie.span(:id,/lblName/) if they are stand alone. If they 
are in a grid catch table, table(:id,/ctlDataGrid/)  and in your table's rows 
catch them as  span(:id,/lblName/) in one row there must be only one lblName, 
sinceasp.net does not allow you to give same id to one object. thereforeyou 
will know that all lblnames are instances of your label(span).

Also your developer override naming of these identifiers. But i do notthink he 
will want to do that.

On 7/21/05, Zeljko Filipin <[EMAIL PROTECTED]> wrote:> >From watir.rb:> > #  
The ways that are available to identify an html object depend upon the> object 
type, but include> #   :id           used for an object that has an ID 
attribute -- this is the> best way!> > I talked to developer and he told me 
that our web applications are developed> in asp.net and that he can not assign 
id property to html object, and that> asp.net does it.> Id is assigned to 
element by it's position at page, something like> > <input id="catalog_1" 
type="checkbox" />> > and id is changed when another element (checkbox in this 
case) is added to> page.> > Example: add another checkbox to page, so it is 
above (before) this one. New> checkbox gets id="catalog_1", and old one is 
changed to id="catalog_2".> > It is just like using :index, and "i always 
consider using :index to be an> ugly hack when nothing else will work." (Bret 
Pettichord)> > Has anybody else this problem (and solution)?> > Zeljko!
> > _______________________________________________> Wtr-general mailing list> 
> > [email protected]> 
> > http://rubyforge.org/mailman/listinfo/wtr-general>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to