Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Gridview problem. Please help

Reply
Thread Tools

Gridview problem. Please help

 
 
pargat.singh@gmail.com
Guest
Posts: n/a
 
      05-02-2007
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;
}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
Please please please help this guy with his open source java app casioculture@gmail.com Java 4 05-05-2005 08:24 AM
Computer problems please please please help Nick Computer Support 0 06-04-2004 08:49 PM
HELP! HELP! PLEASE, PLEASE, PLEASE tpg comcntr Computer Support 11 02-15-2004 06:22 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57