我想将基于typedef void (*keyCallback)(int);
typedef void (*emitterCallback)(void*);
static void registerOnKeyDown(keyCallback cb) {
emitter_subscribe(keyDownEmitter, (emitterCallback)cb);
}
的{{1}} dropdownlist
填入我的申请表中。如果用户未登录,则将显示默认国家/地区。请帮助我并指导我如何根据用户登录国家/地区填写下拉列表。任何帮助都非常感谢。
AspUsers table -- When user register, all the information goes to this table
我的countries
数据模型
User login
我的LeadingClass
查看模型
public int? Type { get; set; }
public string Country { get; set; }
我的LeadingFilterVM
public int? Type { get; set; }
public IEnumerable<SelectListItem> TypeList { get; set; }
public string Country { get; set; }
public IEnumerable<SelectListItem> CountriesList { get; set; }
public IPagedList<LeadingClass> Leadings { get; set; }
我的LeadingDatabaseHandle
控制器
public List<LeadingClass> LeadingBasedonFilter(int? Type, string Country = "")
{
clsUtilities clsUtilities = new clsUtilities();
DataSet ds;
List<LeadingClass> leadingClass = new List<LeadingClass>();
string sSQL;
SqlParameter[] prms = new SqlParameter[3];
sSQL = "exec GetLeeading @Type,@country";
prms[0] = new SqlParameter("@Type", SqlDbType.Int);
prms[0].Value = Sire;
prms[1] = new SqlParameter("@Country", SqlDbType.VarChar);
prms[1].Value = Country;
ds = clsUtilities.CreateCommandwithParams(sSQL, prms);
DataTable dataTable = ds.Tables[0];
foreach (DataRow dr in dataTable.Rows)
{
leadingClass.Add(
new LeadingClass
{
Id = Convert.ToInt32(dr["Id"]),
Name= Convert.ToString(dr["Name"]),
}
);
}
return leadingClass;
}
我的Home
查看
[HttpGet]
public ActionResult Leading(int? type, string country,int? pageNumber)
{
LeadingDatabaseHandle leadingDatabaseHandle = new LeadingDatabaseHandle();
IEnumerable<LeadingClass> data;
if (type!=null)
{
data = leadingDatabaseHandle.LeadingBasedonFilter(type.Value, country);
}
else
{
data = leadingDatabaseHandle.LeadingSiresAll();
}
LeadingFilterVM model = new LeadingFilterVM
{
Type = type,
Country = country,
TypeList = new List<SelectListItem>
{
new SelectListItem{ Text = "General", Value = "1" },
new SelectListItem{ Text = "Advance", Value = "2" },
},
CountriesList = new List<SelectListItem>
{
new SelectListItem {Value = "NZ", Text="New Zealand" },
new SelectListItem {Value = "AUS", Text = "Australia" },
new SelectListItem {Value = "FR", Text = "France" },
new SelectListItem {Value = "GB", Text = "Great Britain" },
},
Leadings = data.ToPagedList(pageNumber ?? 1, 10)
};
return View(model);
}