<div class="form-group">
<label for="exampleInputEmail1">User Name</label>
<input list="stat" name="user_name" class="form-control" required />
<datalist id="stat">
@foreach (var cell in ViewBag.user)
{
<option>@cell</option>
}
</datalist>
</div>
public ActionResult addHolidayPack()
{
if (Session["User_Name"] != null)
{
try
{
string s = null;
DataTable dt = new DataTable();
string str = "select th_name from Theme_master";
dt = con.GetdataTable(str);
ArrayList lis = new ArrayList();
int n = dt.Rows.Count;
for (int j = 0; j < n; j++)
{
s = dt.Rows[j]["th_name"].ToString();
lis.Add(s);
}
ViewBag.theme = lis;
string s1 = null;
DataTable dt1 = new DataTable();
string str1 = "select PK_name from Pack_Type";
dt1 = con.GetdataTable(str1);
ArrayList lis1 = new ArrayList();
int n1 = dt1.Rows.Count;
for (int j = 0; j < n1; j++)
{
s1 = dt1.Rows[j]["PK_name"].ToString();
lis1.Add(s1);
}
ViewBag.pack = lis1;
string s3 = null;
DataTable dt3 = new DataTable();
string str3 = "select U_Name from User_Master where U_Type='V'";
dt3 = con.GetdataTable(str3);
ArrayList lis3 = new ArrayList();
int n3 = dt3.Rows.Count;
for (int j = 0; j < n3; j++)
{
s3 = dt3.Rows[j]["U_Name"].ToString();
lis3.Add(s3);
}
ViewBag.user = lis3;
return View();
}
catch
{
return View();
}
}
else
{
return RedirectToAction("Login", "Cp");
}
}
<label for="exampleInputEmail1">User Name</label>
<input list="stat" name="user_name" class="form-control" required />
<datalist id="stat">
@foreach (var cell in ViewBag.user)
{
<option>@cell</option>
}
</datalist>
</div>
Controller
public ActionResult addHolidayPack()
{
if (Session["User_Name"] != null)
{
try
{
string s = null;
DataTable dt = new DataTable();
string str = "select th_name from Theme_master";
dt = con.GetdataTable(str);
ArrayList lis = new ArrayList();
int n = dt.Rows.Count;
for (int j = 0; j < n; j++)
{
s = dt.Rows[j]["th_name"].ToString();
lis.Add(s);
}
ViewBag.theme = lis;
string s1 = null;
DataTable dt1 = new DataTable();
string str1 = "select PK_name from Pack_Type";
dt1 = con.GetdataTable(str1);
ArrayList lis1 = new ArrayList();
int n1 = dt1.Rows.Count;
for (int j = 0; j < n1; j++)
{
s1 = dt1.Rows[j]["PK_name"].ToString();
lis1.Add(s1);
}
ViewBag.pack = lis1;
string s3 = null;
DataTable dt3 = new DataTable();
string str3 = "select U_Name from User_Master where U_Type='V'";
dt3 = con.GetdataTable(str3);
ArrayList lis3 = new ArrayList();
int n3 = dt3.Rows.Count;
for (int j = 0; j < n3; j++)
{
s3 = dt3.Rows[j]["U_Name"].ToString();
lis3.Add(s3);
}
ViewBag.user = lis3;
return View();
}
catch
{
return View();
}
}
else
{
return RedirectToAction("Login", "Cp");
}
}
No comments:
Post a Comment