protected void btnAction_Click(object sender, EventArgs e) { Button btn = sender as Button; GridViewRow row = btn.NamingContainer as GridViewRow; int projectId = (int)GridView1.DataKeys[row.RowIndex].Value; //updatePanel1.Update(); int researcherId = int.Parse(Request.QueryString["Id"].ToString()); TextBox txtInfoRequested = (TextBox)row.FindControl("txtInfoRequested"); if (btn.Text == "Apply") { bool result = new Business.BusinessManager().ApplyForProject(researcherId, projectId); } else { bool result = new Business.BusinessManager().SaveInformationRequested(projectId, researcherId, txtInfoRequested.Text); } ProjectDto updatedDto = new Business.BusinessManager().GetProjectById(projectId, researcherId); List <ProjectDto> dtos = ((List <ProjectDto>)Session["ResearcherProjects"]); ProjectDto existing = dtos.First(p => p.ProjectId == projectId); dtos.Remove(existing); dtos.Add(updatedDto); dtos = dtos.OrderBy(p => p.ProjectId).ToList(); GridView1.DataSource = dtos; GridView1.DataBind(); }
protected void btnRegister_Click(object sender, EventArgs e) { try { string expertiseIdsStr = string.Join(",", cbxCheckBoxList.Items.Cast <ListItem>().Where(i => i.Selected == true).Select(i => int.Parse(i.Value)).ToArray()); string availableMonthsStr = string.Join(",", cbxMonths.Items.Cast <ListItem>().Where(i => i.Selected == true).Select(i => int.Parse(i.Value)).ToArray()); int newUserId = new Business.BusinessManager().RegisterUser(txtFirstName.Text, txtLastName.Text, txtEmail.Text, txtPassword1.Text, txtCity.Text, txtState.Text, long.Parse(txtPhoneNumber.Text), expertiseIdsStr, txtCity.Text, txtOrg.Text, availableMonthsStr); Response.Redirect("ResearcherDashboard.aspx?Id=" + newUserId); } catch (Exception ex) { txtError.Text = ex.Message; this.txtError.Visible = true; } }