problem with listview

1 posts, 0 answers
  1. Hamza
    Hamza avatar
    24 posts
    Member since:
    Feb 2011

    Posted 29 Sep 2011 Link to this post




    hi all :)

    I have a list view, and I want to pass some parameters when index change

    I take some ideas from this demo for list box

    http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/relatedlistboxes/defaultcs.aspx


    but I still have some thing that never converted with me to suit list view

    here it is

    protected void Page_Load(object sender, EventArgs e)
    {
        RadListBox1.ItemDataBound += new Telerik.Web.UI.RadListBoxItemEventHandler(RadListBox1_ItemDataBound);
        RadListBox1.SelectedIndexChanged += new EventHandler(RadListBox1_SelectedIndexChanged);      
    }


    and here is the functions, they did well when I use it by index, so no problem with next code

    void RadListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        #region Start mode customization via Web Query String
        int idx = 0;
        int auto = 0;
        string qry = "";
     
        try
        {
            qry = "auto";
            qry = (Request.QueryString[qry] == null) ? "" : Request.QueryString[qry];
            if (qry != "") { auto = int.Parse(qry); }
        }
        catch { }
     
        // Item index
        try
        {
            qry = "item";
            qry = (Request.QueryString[qry] == null) ? "" : Request.QueryString[qry];
            if (qry != "") { idx = int.Parse(qry); }
        }
        catch { }
        #endregion
        Literal1.Text = YouTubeScript.Get(RadListView1.SelectedItems[0].GetDataKeyValue("Video_Path").ToString(), auto, _W, _H);
        Label1.Text = RadListView1.SelectedItems[0].GetDataKeyValue("Video_Path").ToString();
    }
     
     
    protected void RadListView1_ItemDataBound(object sender, Telerik.Web.UI.RadListViewItemEventArgs e)
    {
        Literal1.Text = YouTubeScript.Get(RadListView1.Items[0].GetDataKeyValue("Video_Path").ToString(), 0, _W, _H).ToString();
        Label1.Text = RadListView1.Items[0].GetDataKeyValue("Video_Description").ToString();
    }
Back to Top