如何在列表视图中检索文本框值 [英] how retrive the textbox values in a list view
本文介绍了如何在列表视图中检索文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用fillexisting时间表能够获得o / p中的7天文本框,但是这些是空的如何使用数据库记录填充。
using fillexisting time sheet i m able to get the 7days textboxes in the o/p but those are empty how to fill using database record.
private List<ManageTimeSheetDetailModel> fillExistingTimeSheet(DataSet ds, DateTime weekStartDate)
{
ManageTimeSheetsModel objManageTimeSheetsModel = null;
List<ManageTimeSheetDetailModel> objManageTimeSheetDetailModelLst = new List<ManageTimeSheetDetailModel>();
ManageTimeSheetDetailModel objManageTimeSheetDetailModel = new ManageTimeSheetDetailModel();
objManageTimeSheetDetailModel.EmployeeID = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
objManageTimeSheetDetailModel.OrganisationID = Convert.ToInt32(ds.Tables[0].Rows[0][1].ToString());
objManageTimeSheetDetailModel.WeekStartDate = weekStartDate;
objManageTimeSheetDetailModel.TimesheetModelList = new List<ManageTimeSheetsModel>();
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
objManageTimeSheetsModel = new ManageTimeSheetsModel();
objManageTimeSheetsModel.EmployeeID = Convert.ToInt32(ds.Tables[0].Rows[i]["Employeeid"].ToString());
objManageTimeSheetsModel.OrganisationID = Convert.ToInt32(ds.Tables[0].Rows[i]["OrganisationID"]);
objManageTimeSheetsModel.Timesheetdate = Convert.ToDateTime(ds.Tables[0].Rows[i]["Timesheetdate"]);
objManageTimeSheetsModel.Workinghours = Convert.ToDecimal(ds.Tables[0].Rows[i]["Workinghours"]);
objManageTimeSheetsModel.Leavehours = Convert.ToDecimal(ds.Tables[0].Rows[i]["Leavehours"]);
objManageTimeSheetsModel.status = (ds.Tables[0].Rows[i]["Status"]).ToString();
objManageTimeSheetDetailModel.TimesheetModelList.Add(objManageTimeSheetsModel);
objManageTimeSheetDetailModelLst.Add(objManageTimeSheetDetailModel);
}
return objManageTimeSheetDetailModelLst;
}
推荐答案
Here's what you will need to get textbox and it's value on button click:
1: <asp:ListView ID="ListView1" runat="server" onitemcommand="ListView1_ItemCommand">
2: <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Save">Save</asp:LinkButton>
3:
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "Save")
{
TextBox tb = (TextBox)e.Item.FindControl("TextBox1");
string x = tb.Text;
}
}
这篇关于如何在列表视图中检索文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文