protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ArrayList volunteerList = EIDdbVolunteerManagement.retrieveVolunteer(); dlvolunteer.DataSource = volunteerList; dlvolunteer.DataBind(); } }
protected void dlResident_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Del") { int ID = (int)dlvolunteer.DataKeys[e.Item.ItemIndex]; EIDdbVolunteerManagement.DeleteByID(ID); } ArrayList volunteerList = EIDdbVolunteerManagement.retrieveVolunteer(); dlvolunteer.DataSource = volunteerList; dlvolunteer.DataBind(); }
protected void btnSubmit_Click(object sender, ImageClickEventArgs e) { int count = 0; string temp = ""; foreach (ListItem m in cblday.Items) { if (m.Selected) { count++; if (count == 1) { temp += m.Text; } else { temp += ", " + m.Text; } } } Volunteer vol = new Volunteer(); vol.VolunteerName = tbxfirstname.Text + " " + tbxlastname.Text; vol.VolunteerNric = tbxnric.Text; vol.VolunteerAddress = tbxaddress.Text; vol.VolunteerContactNumber = Convert.ToInt32(tbxphone.Text); vol.VolunteerEmail = tbxemailaddress.Text; vol.VolunteerAvaliabeSlot = tbxremarks.Text; vol.VolunteerDay = temp; vol.VolunteerTime = ddltime.Text; if (tbxdescription.Text == "") { vol.Description = "NIL"; } else { vol.Description = tbxdescription.Text; } vol.Remarks = tbxremarks.Text; vol.StaffNo = 1; if (EIDdbVolunteerManagement.InsertVol(vol, 1) == 1) { int id = EIDdbVolunteerManagement.RetrieveMaxID(); Response.Redirect("VolunteerViewPage.aspx?volunteerNo=" + id); } //Session["staffid"] }
protected void Page_Load(object sender, EventArgs e) { int temp = Convert.ToInt32(Request.QueryString["volunteerNo"]); Volunteer volAll = EIDdbVolunteerManagement.RetrieveAllByVol(temp); lblVolunterID.Text = Convert.ToString(volAll.VolunteerNo); lblnric.Text = volAll.VolunteerNric; lblvoluntername.Text = volAll.VolunteerName; lbladdress.Text = volAll.VolunteerAddress; lblphonenumber.Text = Convert.ToString(volAll.VolunteerContactNumber); lblEmail.Text = volAll.VolunteerEmail; lbldescription.Text = volAll.Description; lblremarks.Text = volAll.Remarks; lbldaytime.Text = volAll.VolunteerDay + ", " + volAll.VolunteerTime; lblstaff.Text = Convert.ToString(volAll.StaffNo); }