Dec 12, 2011, 10:11 AM
[CLOSED] How to Create dynamic LinkButton from the controllers of the MVC model
Hi,
I need to create a list of Link Buttons to donwload docs. A basic example (only one linkbutton):
Page Code:
Thanks so much!
I need to create a list of Link Buttons to donwload docs. A basic example (only one linkbutton):
Page Code:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>DocumentacionJunta</title>
<link href="../../Content/Style/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="fileform" class="x-hide-display" />
<ext:ResourceManager ID="ResourceManagerDelelgacion" runat="server" >
<DirectEvents>
<DocumentReady Url="~/DocumentacionJunta/LoadLinks" />
</DirectEvents>
</ext:ResourceManager>
<ext:Viewport ID="vpDocumentacionJunta" runat="server">
<Items>
<ext:Panel ID="containerEnlaces" runat="server" Margins="5 5 5 5" Frame="true" />
</Items>
</ext:Viewport>
</body>
</html>
DocumentReady Controller:public AjaxResult LoadLinks()
{
AjaxResult respuesta = new AjaxResult();
Ext.Net.LinkButton link = new Ext.Net.LinkButton();
link.Text = "Prueba de Descarga";
link.DirectEvents.Click.Url = "/GestionDocumental/DownloadDoc/";
link.DirectEvents.Click.FormID = "fileform";
link.DirectEvents.Click.Buffer = 300;
link.DirectEvents.Click.IsUpload = true;
link.DirectEvents.Click.Method = Ext.Net.HttpMethod.GET;
link.DirectEvents.Click.AutoDataBind = true;
link.DirectEvents.Click.ExtraParams.Add(new Ext.Net.Parameter("idDoc", "99", Ext.Net.ParameterMode.Value));
respuesta.Script = link.ToScript(Ext.Net.RenderMode.AddTo, "containerEnlaces");
return respuesta;
}
LinkButton Contoller:public ActionResult DownloadDoc(int idDoc)
{
gestor = new GestDoc();
Downloader doc = gestor.DownloadDocs(int.Parse(idDoc), Saving.Db);
return doc;
}
The problem is that value of parameter idDoc is null in DownloadDoc contoller.Thanks so much!
Last edited by Daniil; Dec 12, 2011 at 2:40 PM.
Reason: [CLOSED]