PDA

View Full Version : [CLOSED] IAppType not working



jesperhp
Feb 07, 2014, 5:21 AM
IAppType does not work, actually here I bind store to combobox onLoad event, When click on combobox from view then call goes to server side with IAppType and IAppType return a specific value to server side calling url
It works in v1.1 but not in v2.x... Is there anything missing or something wrong



<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="../Shared/Controls_Store/store_Departments.ascx" TagName="store_Departments"
TagPrefix="uc1" %>
<uc1:store_Departments ID="store_Departments1" runat="server" Url="/Departments/get_Departments_which_have_Creat_Access_on"
IAppType="HelpDeskCategory2.getIAppType()" />
<script runat="server">
protected override void OnLoad(EventArgs e)
{
this.cmb_Departments.StoreID = this.store_Departments1.StoreId;
base.OnLoad(e);
}
</script>
<ext:Window runat="server" ID="window_Detail" Width="400px" Layout="Form" Title="<%$ Resources:HelpDeskWebApp,AddNewCategory2%>"
Padding="10" AutoHeight="true" Modal="true" Closable="True" Resizable="false">
<Content>
<ext:FormPanel ID="FormPanel1" runat="server" BodyBorder="false" BodyStyle="background-color:#dfe8f6"
MonitorValid="true">
<Content>
<ext:TextField FieldLabel="<%$ Resources:HelpDeskWebApp,Name%>" ID="txtCategoryName" runat="server" AnchorHorizontal="94%"
AllowBlank="false" IsRemoteValidation="true">
<RemoteValidation Url="/HelpDeskCategory2/ValidateCategory" Json="true">
</RemoteValidation>
</ext:TextField>
<ext:ComboBox ID="cmb_Departments" runat="server" AllowBlank="false" Editable="false"
DisplayField="Name" ValueField="ID" AnchorHorizontal="94%" FieldLabel="<%$ Resources:HelpDeskWebApp,DepartmentName%>"
EmptyText="Select Department">
</ext:ComboBox>
</Content>
</ext:FormPanel>
</Content>
</ext:Window>




Here server side code where URL hit on combobox clicked



public ActionResult get_Departments_which_have_Creat_Access_on(int IAppType = 0)
{
//AppType unit = Unit.getAppType();
List<Department> List_Departments = new RightsAssignment().getAllDepartments_on_whichLogge dinUserhaveRight(Right.Creat, IAppType);
IEnumerable<object> Enumrable_Department = from department in List_Departments
select new
{
ID = department.DepartmentID,
Name = department.Name
};
List<object> List_object_Departments = Enumrable_Department.ToList();
int totalRecords = List_object_Departments.Count;
var jsonData = new
{
rows = List_object_Departments,
total = totalRecords
};
return Json(jsonData, JsonRequestBehavior.AllowGet);
}



Store of department which was bind to onLoad Event


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %><%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected override void OnInit(EventArgs e)
{
this.store_Department.ID = this.ID + "_store";
base.OnInit(e);
}
public string Url
{
get
{
return (this.store_Department.Proxy.Primary as AjaxProxy).Url;
}
set
{
(this.store_Department.Proxy.Primary as AjaxProxy).Url = value;
}
}
public string StoreId
{
get
{
return this.store_Department.ID;
}
}
public string IAppType
{
set
{
Ext.Net.Parameter parameter_IAppType = new Ext.Net.Parameter("IAppType", value, ParameterMode.Raw);
this.store_Department.Parameters.Add(parameter_IAp pType);
}
}
</script>
<ext:Store ID="store_Department" runat="server" RemoteSort="true" AutoLoad="false" PageSize="50">
<Proxy>
<ext:AjaxProxy Json="true">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="rows" IDProperty="ID" TotalProperty="total" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model runat="server" ID="Model_Department">
<Fields>
<ext:ModelField Name="ID" SortDir="ASC" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="ICompany" />
<ext:ModelField Name="CompanyName" />
</Fields>
</ext:Model>
</Model>
<Parameters>
<ext:StoreParameter Name="start" Value="0" Mode="Raw" />
<ext:StoreParameter Name="dir" Value="ASC" />
<ext:StoreParameter Name="sort" Value="ID" />
<ext:StoreParameter Name="gridfilters" Value="" />
</Parameters>
</ext:Store>

Daniil
Feb 07, 2014, 5:35 AM
Hi @jesperhp,

Please try

Ext.Net.StoreParameter parameter_IAppType = new Ext.Net.StoreParameter("IAppType", value, ParameterMode.Raw) { Action = "read" };
instead of

Ext.Net.Parameter parameter_IAppType = new Ext.Net.Parameter("IAppType", value, ParameterMode.Raw);

jesperhp
Feb 07, 2014, 6:23 AM
Hi @jesperhp,

Please try

Ext.Net.StoreParameter parameter_IAppType = new Ext.Net.StoreParameter("IAppType", value, ParameterMode.Raw) { Action = "read" };
instead of

Ext.Net.Parameter parameter_IAppType = new Ext.Net.Parameter("IAppType", value, ParameterMode.Raw);


Thanks

please mark it close