
SearchResultGrid.MasterTableView.CurrentPageIndex = 0;
GridSortExpression ge = new GridSortExpression();
ge.FieldName =
"CustomerID";
ge.SortOrder =
GridSortOrder.Descending;
SearchResultGrid.MasterTableView.SortExpressions.Add(ge);
SearchResultGrid.Rebind();
The code above sorts the data in the grid with no issues... However, it does not select the column and visually show that it is sorted. Here is the grid code:
<
telerik:RadGrid ID="SearchResultGrid" EnableAJAX="False" ShowStatusBar="True" PageSize="25" Width="99%" AllowPaging="True"
AllowSorting="True" runat="server" Skin="Green" EnableEmbeddedSkins="false" GridLines="Both" OnNeedDataSource="SearchResultGrid_NeedDataSource">
<clientsettings allowkeyboardnavigation="True">
<Selecting AllowRowSelect="false" />
<Resizing AllowColumnResize="True" AllowRowResize="False" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" />
<ClientEvents OnActiveRowChanged="ActiveRowChanged" OnRowSelected="RowSelected" OnKeyPress="GridKeyPressed"/>
</clientsettings>
<mastertableview autogeneratecolumns="false" clientdatakeynames="CustomerID,SiteID">
<Columns>
<telerik:GridTemplateColumn UniqueName="CustomerID" HeaderText="Customer" SortExpression="CustomerId" >
<itemtemplate>
<a href="javascript:document.getElementById('SearchTracker').value = '0';CloseWindowWithArgument('<%# Eval("CustomerID")+"','"+ Eval("SiteID") %>');"><%# Eval("CustomerId") %></a>
</itemtemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn Visible="false" HeaderText="Customer" UniqueName="ExportCustomerID" DataField="CustomerId" DataFormatString="{0} " SortExpression="CustomerId"/>
<telerik:GridBoundColumn HeaderText="Site Id" HeaderStyle-Width="5%" DataField="SiteID" UniqueName="SiteID" DataFormatString="{0} " SortExpression="SiteID" />
<telerik:GridBoundColumn HeaderText="Customer Name" HeaderStyle-Width="30%" DataField="CustomerName" UniqueName="CustomerName" SortExpression="CustomerName" />
<telerik:GridBoundColumn HeaderText="Address" HeaderStyle-Width="30%" DataField="AddressLine1" UniqueName="Address" SortExpression="AddressLine1" />
<telerik:GridBoundColumn HeaderText="City" HeaderStyle-Width="20%" DataField="City" UniqueName="City" SortExpression="City" />
<telerik:GridBoundColumn HeaderText="State" HeaderStyle-Width="5%" DataField="State" UniqueName="State" SortExpression="State" />
</Columns>
<NoRecordsTemplate>
<div class="NoRecordText">No records to display.</div>
</NoRecordsTemplate>
</mastertableview>
<pagerstyle mode="NumericPages" AlwaysVisible="true" />
</telerik:RadGrid>
The grid is in a table cell, in a div. How can I get the grid to visually show the sort expression?
Thanks,
- Adam

I am trying to put raddatetime picker and some other control inside my Gridview for editing purpose but always getting errors like in subject could not find control inside gridview pls help me how can I solve this problem. All help will be appreciated and thank you in advance
| <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" |
| DataSourceID="SqlDataSource1" DataKeyNames="ID" |
| PageSize="20" > |
| <PagerSettings Position="TopAndBottom" /> |
| <Columns> |
| <asp:CommandField ButtonType="Button" CancelText="Çık" EditText="Düzenle" |
| ShowEditButton="True" UpdateText="Güncelle" /> |
| <asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID"> |
| <ItemTemplate> |
| <asp:Label ID="Label8" runat="server" Text='<%# Bind("ID") %>'></asp:Label> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:TemplateField HeaderText="UserName" SortExpression="UserName"> |
| <ItemTemplate> |
| <asp:Label ID="Label1" runat="server" Text='<%# Bind("UserName") %>'></asp:Label> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:TemplateField HeaderText="Name" SortExpression="Name"> |
| <ItemTemplate> |
| <asp:Label ID="Label2" runat="server" Text='<%# Bind("Name") %>'></asp:Label> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:TemplateField HeaderText="SicilNo" SortExpression="SicilNo"> |
| <ItemTemplate> |
| <asp:Label ID="Label3" runat="server" Text='<%# Bind("SicilNo") %>'></asp:Label> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:TemplateField HeaderText="CartNo" SortExpression="CartNo"> |
| <EditItemTemplate> |
| <asp:TextBox ID="txtCard" runat="server" Text='<%# Bind("CartNo") %>' |
| ToolTip="5 karakter" Width="50px"></asp:TextBox> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="Label4" runat="server" Text='<%# Bind("CartNo") %>'></asp:Label> |
| </ItemTemplate> |
| <ItemStyle Width="50px" /> |
| </asp:TemplateField> |
| <asp:TemplateField HeaderText="CartNoStartDate" |
| SortExpression="CartNoStartDate"> |
| <EditItemTemplate> |
| <telerik:RadDatePicker ID="RadDatePicker1" SelectedDate='<%# Bind("CartNoStartDate") %>' runat="server"> |
| </telerik:RadDatePicker> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="Label5" runat="server" Text='<%# Bind("CartNoStartDate") %>'></asp:Label> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:TemplateField HeaderText="CartNoEndDate" SortExpression="CartNoEndDate"> |
| <EditItemTemplate> |
| <telerik:RadDatePicker ID="RadDatePicker2" SelectedDate='<%# Bind("CartNoEndDate") %>' runat="server"> |
| </telerik:RadDatePicker> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="Label6" runat="server" Text='<%# Bind("CartNoEndDate") %>'></asp:Label> |
| </ItemTemplate> |
| </asp:TemplateField> |
| <asp:TemplateField HeaderText="IsDeleted" SortExpression="IsDeleted"> |
| <EditItemTemplate> |
| <asp:DropDownList ID="ddlBool" runat="server" SelectedValue= '<%# Bind("IsDeleted") %>'> |
| <asp:ListItem Text="Evet" Value="1" /> |
| <asp:ListItem Text="Hayır" Value="0" /> |
| </asp:DropDownList> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="Label7" runat="server" Text='<%# Bind("IsDeleted") %>'></asp:Label> |
| </ItemTemplate> |
| </asp:TemplateField> |
| </Columns> |
| </asp:GridView> |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" |
| ConnectionString="<%$ ConnectionStrings:pdksConnectionString %>" |
| SelectCommand="SELECT UserName, Name, SicilNo, CartNo, CartNoStartDate, CartNoEndDate, IsDeleted, ID FROM Users WHERE (SicilNo LIKE '%' + @SicilNo + '%') OR (UserName LIKE '%' + @username + '%') ORDER BY Name, SicilNo, CartNo" |
| UpdateCommand="UPDATE Users SET CartNoEndDate = @CardNoEndDate, CartNoStartDate = @CardNoStartDate,CartNo = @CartNo,IsDeleted = @IsDeleted WHERE (ID = @ID)" |
| InsertCommand="INSERT INTO Users(UserName, Name, SicilNo, CartNo, CartNoStartDate, CartNoEndDate, IsDeleted, vardiya) VALUES (@username, @name, @SicilNo, @CartNo, GETDATE(), @CartNoEndDate, 0, 1)"> |
| <SelectParameters> |
| <asp:ControlParameter ControlID="txtSicil" DefaultValue="NULL" Name="SicilNo" |
| PropertyName="Text" Type="String" /> |
| <asp:ControlParameter ControlID="txtSicil" DefaultValue="" Name="username" |
| PropertyName="Text" /> |
| </SelectParameters> |
| <DeleteParameters> |
| <asp:Parameter Name="ID" /> |
| </DeleteParameters> |
| <UpdateParameters> |
| <asp:ControlParameter ControlID="RadDatePicker1" |
| ConvertEmptyStringToNull="False" DbType="DateTime" DefaultValue="" |
| Name="CardNoStartDate" PropertyName="SelectedDate" /> |
| <asp:ControlParameter ControlID="RadDatePicker2" |
| ConvertEmptyStringToNull="False" DbType="DateTime" DefaultValue="" |
| Name="CardNoEndDate" PropertyName="SelectedDate" /> |
| <asp:ControlParameter ControlID="txtCard" |
| ConvertEmptyStringToNull="False" DbType="String" DefaultValue="" |
| Name="CartNo" PropertyName="Text" /> |
| <asp:ControlParameter ControlID="ddlBool" |
| ConvertEmptyStringToNull="False" DbType="Boolean" DefaultValue="" |
| Name="IsDeleted" PropertyName="Value" /> |
| <asp:ControlParameter ControlID="GridView1" DefaultValue="0" Name="ID" |
| PropertyName="SelectedValue" Type="Int32" /> |
| </UpdateParameters> |
| <InsertParameters> |
| <asp:Parameter Name="username" /> |
| <asp:Parameter Name="name" /> |
| <asp:Parameter Name="SicilNo" /> |
| <asp:Parameter Name="CartNo" /> |
| <asp:Parameter Name="CartNoEndDate" /> |
| </InsertParameters> |
| </asp:SqlDataSource> |
function
getTree() {
return $find('navTree')
}
and now I'm trying to access the tree from then parent object like that:
tree = document.getElementById(
"iFrameTreeview").contentWindow.getTree()
var nodes = tree.get_Nodes();
But the broser reports: tree.get_Nodes is not a function
What should I do to get Access to the tree from the parent-site?
Thanks for your support.
| <ItemTemplate> |
| <div id="TheValue" runat="server">> |
| Test Id: |
| <%#DataBinder.Eval(Container, "Value")%> |
| <br /> |
| </div> |
| <div id="TheText" runat="server"> |
| Name: |
| <%#DataBinder.Eval(Container, "Text")%> |
| <br /> |
| </div> |
| <div id="dateadded" runat="server"> |
| Date Added: |
| <%=DateTime.Now.ToShortDateString()%> |
| </div> |
| <hr style="height: 1px; border-color: Black; border-style: solid; width: 95%" /> |
| </ItemTemplate> |
| For Each item As RadListBoxItem In RadListBoxDestination.Items |
| 'Grab variables from ItemTemplate (e.g. dateadded ) and do stuff |
| Next |
I am trying to get an Eval value from my radgrid to my c# codebehind. The value is binded to a hiddenfield and I want to get the value after I hit the built in edit button. To achieve this I am trying to get the hiddenvalue1 to javascript and then somehow get it to my c# code behind. The closest thing I have come to that is binding the value to a hyperlink that when clicked shows an alert with the binded value as shown below. I need something that is automatic where I don’t need to hit a button. Can anyone help?
<asp:HyperLink id="hklk" runat="server" Text='<%# Eval("id") %>' onclick="return GiveAlert(this);"></asp:HyperLink>
function GiveAlert(con)
{
alert(con.innerHTML);
return false;
}

| System.InvalidOperationException: Databinding methods such as Eval(), XPath(), |
| and Bind() can only be used in the context of a databound control. |
| %# DataBinder.Eval(this, "DataItem.Name") %> |