protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "AgregarComentario") { if (((TextBox)e.Item.FindControl("TextBox1")).Text == "") { Mensaje("--Llena el campo. Por favor--"); } else { Int64 id = (Int64)DataList1.DataKeys[e.Item.ItemIndex]; ComentarioBO ob = new ComentarioBO(); string g = ((TextBox)e.Item.FindControl("TextBox1")).Text; if (g.Trim().Length != 0) { ob.Contenido = g; } ob.CodPub = Convert.ToInt32(id); ob.CodUsuario = codUser; servicio.AgregarComentario(ob); ((TextBox)e.Item.FindControl("TextBox1")).Text = ""; Mensaje("Mensaje agregado con exito"); } } if (e.CommandName == "VerComentarios") { Int64 id = (Int64)DataList1.DataKeys[e.Item.ItemIndex]; ComentarioBO d = new ComentarioBO(); d.CodPub = Convert.ToInt32(id); DataSet dataSet = JsonConvert.DeserializeObject <DataSet>(servicio.DevuelveComentarios(d)); Repeater1.DataSource = dataSet.Tables[0]; Repeater1.DataBind(); } if (e.CommandName == "VerVideo") { Int64 id = (Int64)DataList1.DataKeys[e.Item.ItemIndex]; ds = servicio.Videos(Convert.ToInt32(id)); DataRow dr; dr = ds.Tables[0].Rows[0]; string c = dr["video"].ToString(); if (c != "") { byte[] vid = (byte[])dr["video"]; if (vid != null) { DataList2.DataSource = servicio.Videos(Convert.ToInt32(id)); DataList2.DataBind(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal2();", true); } } else { Mensaje("No hay video disponible"); } } }