DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: 2 May 2007 07:28:18 -0700,    posted on: microsoft.public.dotnet.framework.aspnet.datagridcontrol        back       

Thread Index
  1    unknown


Gridview problem. Please help   
Hi:

  I am using a grid and having a problem with sorting. Below are my
code and change the header name at run time as below based on
language.If i don't change the header name it work. Can someone please
help me so that i can enable the sorting and change the header as
well. Thanks, in advance.


               <asp:GridView ID="GridView1" CellPadding="5"
EmptyDataText="No Data Found" GridLines="Vertical"
                   ShowFooter="True" CssClass="gridview"
AlternatingRowStyle-CssClass="even" Width="620px"
                   runat="server" AutoGenerateColumns="False"
DataSourceID="ObjectDataSource2" AllowSorting="true"
                   OnDataBound="GridView1_DataBound"
OnRowDataBound="GridView1_RowDataBound"
OnRowCreated="GridView1_RowCreated"
                   EnableViewState="true">
                   <Columns>
                       <asp:BoundField HtmlEncode="False" HeaderStyle-
VerticalAlign="Top" DataFormatString="{0:C4}"
                           DataField="GRANT_PRICE"
SortExpression="GRANT_PRICE" ItemStyle-HorizontalAlign="right" />
                       <asp:BoundField DataField="GRANT_DATE"
HeaderStyle-HorizontalAlign="Right" HeaderStyle-VerticalAlign="Top"
                           ItemStyle-Wrap="false"
SortExpression="GRANT_DATE" ItemStyle-HorizontalAlign="right" />
                       <asp:BoundField DataField="PLAN_ID"
HeaderStyle-VerticalAlign="Top" SortExpression="PLAN_ID" />
                       <asp:BoundField DataField="AGGREMENT"
HeaderStyle-VerticalAlign="Top" SortExpression="AGGREMENT" />
                       <asp:BoundField DataField="BALANCE_OPTIONS"
HeaderStyle-VerticalAlign="Top" SortExpression="BALANCE_OPTIONS"
                           ItemStyle-HorizontalAlign="right" />
                   </Columns>
                   <AlternatingRowStyle />
               </asp:GridView>

              <asp:ObjectDataSource ID="ObjectDataSource2"
runat="server" SelectMethod="GetDetail"
                   TypeName="cBMOSOP">
                   <SelectParameters>
                       <asp:ControlParameter ControlID="clientIDH"
Name="clientID" PropertyName="Value"
                           Type="String" />
                       <asp:ControlParameter ControlID="baseIDH"
Name="baseID" PropertyName="Value" Type="String" />
                   </SelectParameters>
               </asp:ObjectDataSource>


   protected void GridView1_RowCreated( object sender,
GridViewRowEventArgs e )
   {
       if ( e.Row.RowType == DataControlRowType.Header )
       {
           e.Row.Cells[0].Text = lblGrantPrice.Value;
           e.Row.Cells[0].ColumnSpan = 2;
           e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Right;
           e.Row.Cells[1].Text = lblGrantDate.Value;
           e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Left;
           e.Row.Cells[2].Text = lblPlanID.Value;
           e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Left;
           e.Row.Cells[3].Text = lblAggrementReceived.Value;
           e.Row.Cells[3].HorizontalAlign = HorizontalAlign.Left;
           e.Row.Cells[4].Text = lblAvailableShares.Value;
           e.Row.Cells[4].HorizontalAlign = HorizontalAlign.Right;
           e.Row.Cells[5].Text = lblOptionToExercise.Value;
           e.Row.Cells[5].HorizontalAlign = HorizontalAlign.Right;
       }
   }
Date:2 May 2007 07:28:18 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us