This is a migrated thread and some comments may be shown as answers.

problem with listview

0 Answers 68 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Hamza
Top achievements
Rank 1
Hamza asked on 29 Sep 2011, 03:37 PM



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();
}

No answers yet. Maybe you can help?

Tags
ListView
Asked by
Hamza
Top achievements
Rank 1
Share this question
or