<label> @Html.DropDownList("LeadsID", (SelectList)ViewBag.Values, new { onchange="FindLeadDetails(this.value)" })</label>
<label>Firs tname</label>
@Html.TextBoxFor(fname => fname.Firstname)
<label>Last Name</label>
@Html.TextBoxFor(lname => lname.Lastname)
<label>Comapny name</label>
@Html.TextBoxFor(cname => cname.Companyname)
<label>Address </label>
@Html.TextBoxFor(model => model.Address1)
private string connstring = ConfigurationManager.ConnectionStrings["UsersContext"].ConnectionString;
public string LeadsOwner {get;set;}
public string Title {get;set;}
public string Firstname {get;set;}
public string Lastname {get;set;}
public string Companyname {get;set;}
public string Address1 {get;set;}
public string Address2 {get;set;}
public string Address3 {get;set;}
public string Address4 {get;set;}
public string City {get;set;}
public string TelephoneNumber {get;set;}
public string Webaddress {get;set;}
public string LeadStatus {get;set;}
public string LeadsSource {get;set;}
public string Industry {get;set;}
public DateTime CreatedDate { get; set; }
public string Email { get; set; }
public SelectList LeadID { get; set; }
public List<SelectList> LeadsID { get; set; }
public IEnumerable<SelectListItem> Items { get; set; }
public void FindLeadsDetailsById(string LeadID)
{
string custTitle = string.Empty;
SqlConnection con = new SqlConnection(connstring);
con.Open();
SqlCommand Leadscommand = con.CreateCommand();
Leadscommand.CommandText = "SELECT LeadsID,Title,Firstname,Lastname,Companyname,Address1,TelephoneNumber,Webaddress,LeadStatus,LeadsSource,Industry FROM tblLeads WHERE LeadsID='"+LeadID+"'";
SqlDataReader rdrReadr = Leadscommand.ExecuteReader();
while (rdrReadr.Read())
{
Firstname = rdrReadr["Firstname"].ToString();
}
rdrReadr.Close();
Leadscommand.Dispose();
con.Close();
//tblLeads
}
public List<SelectListItem> pupulateLeadsID()
{
string strLeadID = string.Empty;
SqlConnection con = new SqlConnection(connstring);
List<SelectListItem> itemsID = new List<SelectListItem>();
con.Open();
SqlCommand cmdLeadsID = con.CreateCommand();
cmdLeadsID.CommandText = "SELECT LeadsID FROM tblLeads";
SqlDataReader rdrLeadID = cmdLeadsID.ExecuteReader();
while (rdrLeadID.Read())
{
itemsID.Add(new SelectListItem { Text = rdrLeadID[0].ToString(), Value = rdrLeadID[0].ToString() });
}
rdrLeadID.Close();
cmdLeadsID.Dispose();
con.Close();
return itemsID;
}
public ActionResult UpdateLeads()
{
Leads ldl = new Leads();
ViewBag.LeadsID = ldl.pupulateLeadsID();
return View();
}
public ActionResult FindLeadDetails(string LeadID)
{
Leads ld = new Leads();
ld.FindLeadsDetailsById(LeadID);
return View(ld);
}
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.