Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET
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;
 

    }
Posted 27-Feb-13 1:50am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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;
            }
        }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 275
1 DamithSL 265
2 CPallini 235
3 Maciej Los 185
4 George Jonsson 170
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100