 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 15th, 2004, 12:01 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
DataGrid template column
is there a way to control where the DataGrid's <asp:TemplateColumns> appear under <Columns>? Say I want a template column to be displayed after the automatic generated columns. How do I specify that under <Columns>. Please advise.
YUBO
|
|

December 15th, 2004, 12:54 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
You can't do that. Autogenerated columns come after predefined columns.
|
|

December 16th, 2004, 05:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
well,dont use Autogenerated columns,you can use <asp:BoundColumn> instead and change the order of your columns manually.
_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.
|
|

December 16th, 2004, 11:46 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
In order to use 'AllowSorting="True"', autogenerated columns has to be set to "true". <asp:BoundColumn> won't work in this senario.
Quote:
quote:Originally posted by mehdi62b
well,dont use Autogenerated columns,you can use <asp:BoundColumn> instead and change the order of your columns manually.
_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.
|
|
|

December 19th, 2004, 01:56 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
This is not correct. You can allow sorting on your user defined columns (bound or other types of columns), you simply need to provide your own sort expressions for the columns you define.
|
|

December 21st, 2004, 01:59 AM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi all
i have created to template column.
if i put both temple column at last position then it works fine.
but if a change order of temple column then it gives error.
here is the code:
<asp:datagrid id="dgViewHedge" runat="server" Width="797px" BorderColor="#999999" BorderStyle="None"
BorderWidth="1px" BackColor="White" CellPadding="3" GridLines="Vertical" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False"
PageSize="3">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#000084"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:BoundColumn Visible="False" DataField="intComplianceAccountID" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn Visible="False" DataField="intAccountTypeCodeID" HeaderText="Account Type CodeID"></asp:BoundColumn>
<asp:BoundColumn Visible="False" DataField="intSecurityTypeCodeID" HeaderText="Security Type CodeID"></asp:BoundColumn>
<asp:BoundColumn DataField="vchOrganizationName" SortExpression="vchOrganizationName" HeaderText="Organization Name"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Invetment Type">
<ItemTemplate>
<asp:DropDownList id="DropDownList1" runat="server"></asp:DropDownList>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList id="DropDownList2" runat="server"></asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="vchInvestmentDate" SortExpression="vchInvestmentDate" HeaderText="Investment Date"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Securities Type">
<ItemTemplate>
<asp:DropDownList id="DropDownList3" runat="server"></asp:DropDownList>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList id="DropDownList4" runat="server"></asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="mnyAmount" SortExpression="mnyAmount" HeaderText="Amount"></asp:BoundColumn>
<asp:ButtonColumn Text="Delete" HeaderText="Delete" CommandName="Delete"></asp:ButtonColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
When i execute the code it gives me "invalid cast error"?
but if change the order of both template column to last poistions then work fine!
how can put multiple template columns at different positions?
And how ro solve above error?
|
|

December 21st, 2004, 04:47 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Where are you getting this cast error?
|
|

December 21st, 2004, 11:35 PM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
On page_load event i assigned a data source to Datagrid. I m getting this error on datagrid.DataBind() statement.
|
|

December 28th, 2004, 11:08 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
There doesn't appear to be anything wrong with your datagrid markup from what I can tell.
|
|
 |