Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
85 views
Good day!

In the code snippet below I'm always getting RadListView1.SelectedValue from previous ViewState at Page_Load handler.
For example, when I press "3" in the listview, I get "" in LabelRadListView1SelectedValue. Next time I press "5" and get "3" and so on.

Why "RadListView1.SelectedValue" isn't actual at Page_Load event on PostBack?
For example, It's going well at Page_LoadComplete event. So why RadListView1 restored from ViewState after Page_Load event?
I'm confused. Please, help!

RadListVew.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="RadListView.aspx.cs" Inherits="RadListV" %>
 
<%@ Import Namespace="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <telerik:RadListView runat="server" ID="RadListView1" ItemPlaceholderID="PlaceHolderListContainer" DataKeyNames="data">
        <LayoutTemplate>
            <asp:PlaceHolder ID="PlaceHolderListContainer" runat="server"></asp:PlaceHolder>
        </LayoutTemplate>
        <ItemTemplate>
            <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select">
                <asp:Label runat="server" ID="Label1" Text='<%#Eval("data")%>' />
            </asp:LinkButton>
        </ItemTemplate>
        <SelectedItemTemplate>
            <span style="font-weight: bold;">
                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select">
                    <asp:Label runat="server" ID="Label1" Text='<%#Eval("data")%>' />
                </asp:LinkButton>
            </span>
        </SelectedItemTemplate>
    </telerik:RadListView>
 
    <div>
        <asp:Label runat="server" ID="LabelRadListView1SelectedValue" />
    </div>
</asp:Content>


RadListVew.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using Telerik.Web.UI;
 
public partial class RadListV : System.Web.UI.Page
{
    class ListItem
    {
        public int data { get; set; }
    }
 
    List<ListItem> ListDataSource
    {
        get
        {
            return (List<ListItem>)Session["ListDataSource"];
        }
 
        set { Session["ListDataSource"] = value; }
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (RadListView1.SelectedValue != null)
        LabelRadListView1SelectedValue.Text = RadListView1.SelectedValue.ToString();
    }
 
    protected void Page_Init(object sender, EventArgs e)
    {
        ListDataSource = new List<ListItem>();
        for (int i = 1; i < 5; i++)
        {
            ListDataSource.Add(new ListItem { data = i });
        }
        RadListView1.DataSource = ListDataSource;
    }
}




zDog
Top achievements
Rank 1
 answered on 29 May 2014
4 answers
309 views
Hi,

I am trying to get a RadDropDownList to work within a RadGrid. Autogeneratecolumns are set to False and all columns have been set.

The first code snippet is the column I am having issues with. The second code snippet is the same column but doesn't offer the DropDownList feature.
Basically what I am trying to archive, is when a user is looking at the grid, they can easily change the "Team" without the need going to Edit > (Change record) > Update.

​<telerik:GridTemplateColumn>                  <ItemTemplate>                                               <telerik:RadDropDownList DataField="IDNO" DataSourceID="TeamFilterOptions"                                                  HeaderText="123" DataTextField="FieldAnswer"                                                   UniqueName="DocCategoryColumn3" runat="server" ID="ddlEditCategory" AutoPostBack="True"></telerik:RadDropDownList>                  </ItemTemplate>              </telerik:GridTemplateColumn>
 
 
 
 
 
​



<telerik:GridBoundColumn DataField="Team" HeaderText="Team" UniqueName="Team">                                            <FilterTemplate>                                               <telerik:RadComboBox ID="RadListBoxTeam" DataSourceID="TeamFilterOptions" DataTextField="FieldAnswer"                            DataValueField="FieldAnswer" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Team").CurrentFilterValue %>'                            runat="server" OnClientSelectedIndexChanged="TeamIndexChange">                            <Items>                                <telerik:RadComboBoxItem Text="All" />                            </Items>                        </telerik:RadComboBox>                         <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">                            <script type="text/javascript">                                function TeamIndexChange(sender, args) {                                    var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID%>");                                    tableView.filter("Team", args.get_item().get_value(), "EqualTo");                                }                            </script>                        </telerik:RadScriptBlock>                    </FilterTemplate>                </telerik:GridBoundColumn>





My issues I am facing are 
How do I get the item to display the correct text as it just displays the first record from the data source. i.e. pull the data from the RadGrid datasource, the DataTextField should get the "Team" field. When I try to bind the data it just says "System.Data.DataRowView".
Once the user changes the value from the Drop Down List how do I retrieve that value in the code behind (VB.net but C# is fine), I cannot find anything relating to CommandName?

Thanks,
Alex



Shinu
Top achievements
Rank 2
 answered on 29 May 2014
1 answer
76 views
I have a radgrid which contains 4 columns,when i press tab on search filter the focus of cursor should go on next radgrid column filter ideally,but this is not happeing at my side .I have attached gif file .Please have a look at it .


Please Suggest.
Eyup
Telerik team
 answered on 29 May 2014
1 answer
68 views
Hi,

I am currently developing a website with Radgrid in it.
I want to print the rows that the user has chosen (all of the rows from all pages).
(http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-on-sorting.html)

Please help me with the following:
1. printing all selected items.
2. after printing, the grid should display exactly as before (and not change do the print setting).


Thanks,
Daniel
Eyup
Telerik team
 answered on 29 May 2014
1 answer
83 views
I have created dynamic rad grid and implementing paging on it .but if i change the page size grid is refreshing and hiding the paging option as well as the controls on page will hide.

Pls help
attaching the screen shot pls help this is something very urgent.
Princy
Top achievements
Rank 2
 answered on 29 May 2014
6 answers
283 views
Hi ,

I need to display a grid with two headers where the top header gives the text and the bottom header displays a dropdownlist when auto generate Columns set to true.I have a checkbox column  too.I need to display dropdowns on grid headers. Please help me out.

Thanks in advance
Shinu
Top achievements
Rank 2
 answered on 29 May 2014
1 answer
465 views
Hi
I have this code:

<MasterTableView CommandItemDisplay="Top">
                        <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false" ShowExportToPdfButton="true" />

and the  ShowAddNewRecordButton="false" works fine, but the ShowExportToExcelButton="true" is not doing anything. It doesn't cause a crash, however no export to excel button shows up in the CommandDisplay.

What am I doing wrong here?

I am using version 2014.1.403.45 of telerik
Princy
Top achievements
Rank 2
 answered on 29 May 2014
1 answer
72 views
Hi,

I would like to center all columns of RadGrid on the screen display as well as on pdf export of the file. How can I do that? I tried many techniques but didnt see anything happening for example:

gridview.MasterTableView.GetColumn("column").HeaderStyle.HorizontalAlign = HorizontalAlign.center

but without any success.

Any suggestions on that??? thanks
Princy
Top achievements
Rank 2
 answered on 29 May 2014
2 answers
260 views


How to add font awesome icon in appointment subject without losing the existing (default) style.
My Radscheduler is binded with Dataset code is below.

--------------------------aspx------------------------------------------
<telerik:RadScheduler OnClientAppointmentClick="OnClientAppointmentClick" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" CustomAttributeNames="SiteId,UserId" ReadOnly="true" runat="server" ID="RadScheduler1" SelectedView="MonthView" OverflowBehavior="Auto">                    
                    </telerik:RadScheduler>
-------------------------aspx.cs---------------------------------------
RadScheduler1.DataSource = ds;//Dataset
RadScheduler1.DataKeyField = "ScheduleID";
RadScheduler1.DataStartField = "ScheduleDate";
RadScheduler1.DataEndField = "ScheduleDate";
RadScheduler1.DataSubjectField = "Name";// at this stage I want add awesome font if CustomAttributeNames    UserId is not null. this field also available in ds
RadScheduler1.DataBind();

protected void RadScheduler1_AppointmentDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
{
DataRowView row = (DataRowView)e.Appointment.DataItem;
e.Appointment.Attributes.Add("SiteId", row["SiteId"].ToString());
e.Appointment.Attributes.Add("UserId", row["UserId"].ToString());
}
Boyan Dimitrov
Telerik team
 answered on 28 May 2014
1 answer
40 views
Hi,

As you see on the title I have a telerik gridview and when I export it to PDF I want the columns to be displayed in the middle. I tried code that I found in this forum without success. Can you please advice how I can do that??


Thanks
leo
Top achievements
Rank 1
 answered on 28 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?