TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vignesh Kumar
NA
1k
415.9k
Gridview update using footer template
Nov 18 2013 5:10 AM
Hi All,
I have a grid with checkbox, where users can select multiple rows and edit at the same time and save it to the DB. Now I have used a Footer Template with textbox in the gridview. So if I want to put similar data's for some particular rows at the same time in the grid, I select the multiple rows and try to put values in the footer template textbox and when I click on save, it saves successfully.
protected void AIGrid_RowCommand(object sender, GridViewCommandEventArgs e)
{
TextBox Name = (TextBox)GridView1.FooterRow.FindControl("txtFRName");
TextBox Designation = (TextBox)GridView1.FooterRow.FindControl("txtFRDesignation");
TextBox City = (TextBox)GridView1.FooterRow.FindControl("txtFRCity");
string Na = Name.Text;
string Des = Designation.Text;
string Cy = City.Text;
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
bool isChecked = row.Cells[0].Controls.OfType<CheckBox>().FirstOrDefault().Checked;
TextBox EmpID = (TextBox)row.Cells[1].FindControl("txtEmpID");
if (isChecked)
{
if (e.CommandName.Equals("MassSave"))
{
AppGridData.UpdateGridValues(EmpID.Text, Na, Des, Cy);
this.FillVendorGrid();
}
}
}
}
}
UPDATE QUERY:
"UPDATE [Test] SET [Name]='" + Name + "',[Designation]= '" + Designation + "', [City]= '" + City + "' WHERE EmpID='" + EmpID + "'";
Now here is the challenge, but even when I enter null values in the footer template textbox it has to save with the old values of the rows and not null values. I tried it and couldn't make it happen. Anyone pls help me with the code....
Reply
Answers (
0
)
how to show the output of a webservice as an XML file
Wanted to push some tasks on Google tasks.