Friday, September 10, 2010

ve: gridview and the ajax tab control

Posted by david on 8. February 2009 19:41

How to select a row in gridview without using that fugly select button.

Your code would have worked just fine if you had used the display=none
attribute of CSS instead of setting the Visible attribute of the CommandField
to false, e.g.
<asp:CommandField SelectText ="Select"  ShowSelectButton="true"  
ItemStyle-CssClass ="HiddenColumn" />

and in your css add a definition like this:
.HiddenColumn{display:none;}  ( source )

AzamSharp  Custom Extender to Highlight GridView Rows

Select a row in an aspGridView without using a Select Command

this last one works well:

<asp:GridView ID="POIGrid" runat="server"
    AutoGenerateColumns="False" 
    DataKeyNames="POI_ID" 
    DataSourceID="LinqDataSource1"
    Width="200px" 
    OnRowDataBound="POIGrid_RowDataBound" 
    AllowPaging="True">
    <Columns>
        <asp:BoundField DataField="POI_Name" HeaderText="POI_Name" ReadOnly="True" 
            SortExpression="POI_Name" />
        <asp:BoundField DataField="POI_ID" HeaderText="POI_ID" ReadOnly="True" 
            SortExpression="POI_ID" Visible="False"/>
    </Columns>
</asp:GridView>

&

protected void POIGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';";
        e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
 
        e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.POIGrid, "Select$" + e.Row.RowIndex);
    }
}

 

needs some work, but it is functional: simple list, mouse over event, hyperlink clicks to select.  That code, above, is taken from Select a row in an aspGridView without using a Select Command

Here is a demo of the tab control in action at the ASP.NET AJAX site

2009_02_08 has the tab view working with the “no select button” select also working.  It does not have the geoservice working … Because that geoservice stuff was too tightly coupled to that page it was born in.  This new page presents detail view, thus address, only in the details view … & maybe not even there when I get done with it.  The previous page took the input for the geoservice code, an address, straight from the gridview. so it doesn’t work now. huh. next time.

Comments

Add comment


 

biuquote
Loading