Click here to Skip to main content
15,911,496 members

Comments by cityindicator.com (Top 3 by date)

cityindicator.com 27-Feb-16 11:14am View    
Deleted
View Part :
<div style=" margin-top:15px" class="col-md-8">

<div class="col-md-4"><span style=" color:black">Class</span></div>

<div class="col-md-4">

@Html.DropDownListFor(m => m.classlistid, Model.classlistvalue, "<--select-->", new { @class = "textbox" })
</div>
</div>

Modal :
[Required(ErrorMessage = "Please Enter Class")]
[Display(Name = "Enter Class")]

public string classlistid { get; set; }
public List<SelectListItem> classlistvalue
{
get;
set;
}

ControllerPart :
public ActionResult AddStudent(studentmodel MB,FormCollection formCollection) // Calling on http post (on Submit)
{

MB.classlistid = formCollection["classlistid"];

if (ModelState.IsValid)
{


DataLayer.student objDB = new DataLayer.student(); //calling class Dbdata
string result = objDB.AddStudent(MB); // passing Value to DBClass from model
ViewData["result"] = result; // for dislaying message after saving storing output.
ModelState.Clear(); //clearing model
return View();

}

else
{
ModelState.AddModelError("", "Error in saving data");
return View();
}
}
Code Part :

md.Parameters.AddWithValue("@phone", MD.phone);
cmd.Parameters.AddWithValue("@studaderess", MD.address);
cmd.Parameters.AddWithValue("@class", MD.classlistid);
cmd.Parameters.AddWithValue("@section", MD.section);
cmd.Parameters.AddWithValue("@rollno", MD.rollno);
cityindicator.com 26-Feb-16 8:39am View    
Hello ,
Thanks for reply,
but i got same error "An exception of type 'System.NullReferenceException' occurred in App_Web_o33c4lci.dll but was not handled in user code

Additional information: Object reference not set to an instance of an object."
cityindicator.com 31-Jul-15 11:45am View    
Hello Sir,
Your Code is Working f999 but there is little problem,actually i want to show preview on same imagebutton after selecting image...