F
fabrice
hello
is there a way for adding "Sort Expression" in a Datagrid from code behind.
These is my two tests :
in my .aspx page, the datagrid :
------------------------------------
<asp
ataGrid id="myPs4Grid" runat="server"....
...
<Columns>
<asp:BoundColumn DataField="coddos" ReadOnly="true">
<ItemStyle Font-Names="Times New Roman, Times, serif"
ForeColor="#003B6F" Font-Size="10" horizontalalign="Center"
VerticalAlign="Middle" width="15%">
</ItemStyle>
</asp:BoundColumn>
.....
in my code behind :
----------------------------
Sub myPs4Grid_ItemBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Header Then
'First Solution
Dim btn As LinkButton = CType(e.Item.Cells(0).Controls(0), LinkButton)
btn.text="File"
btn.Attributes("SortExpression")="file" ----> it does not work
'Second Solution
CType(e.Item.Cells(0).Controls(0), LinkButton).Text = "File"
e.Item.Cells(0).Attributes("SortExpression")="File" ------------------>
It does not work.
End Sub
Thanks for you help
fabrice
is there a way for adding "Sort Expression" in a Datagrid from code behind.
These is my two tests :
in my .aspx page, the datagrid :
------------------------------------
<asp
...
<Columns>
<asp:BoundColumn DataField="coddos" ReadOnly="true">
<ItemStyle Font-Names="Times New Roman, Times, serif"
ForeColor="#003B6F" Font-Size="10" horizontalalign="Center"
VerticalAlign="Middle" width="15%">
</ItemStyle>
</asp:BoundColumn>
.....
in my code behind :
----------------------------
Sub myPs4Grid_ItemBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Header Then
'First Solution
Dim btn As LinkButton = CType(e.Item.Cells(0).Controls(0), LinkButton)
btn.text="File"
btn.Attributes("SortExpression")="file" ----> it does not work
'Second Solution
CType(e.Item.Cells(0).Controls(0), LinkButton).Text = "File"
e.Item.Cells(0).Attributes("SortExpression")="File" ------------------>
It does not work.
End Sub
Thanks for you help
fabrice