public List<gridview> getrecord(gridview record)
{
List<gridview> gridview1 = new List<gridview>();
using (SqlConnection conn = new SqlConnection(@"Data Source=AGIDNET114\sqlexpress;Initial Catalog=Telerik;User ID=sa;Password=agiline123"))
{
SqlCommand cmd = new SqlCommand("getdemotable", conn);
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
conn.Close();
for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
var model = new gridview();
model.Address = ds.Tables[0].Rows[i]["Address"].ToString();
model.Name = ds.Tables[0].Rows[i]["Name"].ToString();
model.PhoneNo = ds.Tables[0].Rows[i]["PhoneNo"].ToString();
model.Id = ds.Tables[0].Rows[i]["Id"].ToString();
gridview1.Add(model);
}
}
return gridview1;
}
당신이 할 수있는 목록을 사용하여 모델 클래스에이 코드 조각을 따라, 다음
public ActionResult getdata(gridview data)
{
var x = data.getrecord(data);
return View(x);
}
이 참조보기 http://stackoverflow.com/questions/5438798/how-to-에 대한 코드를 추가 선택 - 사용 - 면도기 – Cris
빠른 답장을 보내 주셔서 감사합니다.하지만 SQL 데이터베이스에서 콤보 상자로 데이터를 가져와야합니다. – Ramalingam
무엇을 게시했는지 게시 – Cris