find media player control,label controls in datalist control select item template in c#..

Posted by Gopal_nivas under ASP.NET on 4/26/2010 | Views : 3381 | Status : [Member] | Replies : 1

i was added media player control in select item template inside datalist control..

my coding is like this for to show the selectitem template

protected void CustomerDataList_ItemCommand(
object source, DataListCommandEventArgs e)
if (e.CommandName == "Details")
Media_Player_ASP.NET_Control.Media_Player_Control m;

dl.SelectedIndex = e.Item.ItemIndex;
Label lb1 = (Label)e.Item.FindControl("Label1");
Cache["idd"] = lb1.Text;
Label lb = (Label)e.Item.FindControl("Label2");
string s = lb.Text;

m = (Media_Player_ASP.NET_Control.Media_Player_Control)e.Item.FindControl("mp11");
m.MovieURL = Server.MapPath(lb.Text);
m.AutoStart = true;



it does not finds the label control also and also it come to these lines
m = (Media_Player_ASP.NET_Control.Media_Player_Control)e.Item.FindControl("mp11");
m.MovieURL = Server.MapPath(lb.Text);
it shows error like this

"Object reference not set to an instance of an object."

how to tackle this problem..

need ur suggestions in brief manner..




Posted by: Vuyiswamb on: 4/26/2010 [Member] [MVP] [Administrator] NotApplicable

can i see the declaration of your markup

Thank you for posting at Dotnetfunda

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response