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
aarti yadav
NA
25
4.8k
cant find TetxBox from selectIndexChanged in listview
Oct 21 2014 7:21 AM
i want be able to find a control TextBox from SelectedIndexChanged in listview
TextBox btnModify = (TextBox)item.FindControl("TextBoxL"); // this code is not workign
TextBox btnModify = (TextBox)FindControl("TextBoxL"); // i tried this one also but its to not working
protected void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox btnModify = (TextBox)items.FindControl("TextBoxL");
SqlConnection c = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);
int myindex = ListView1.SelectedIndex;
string myId = ListView1.DataKeys[myindex][0].ToString();
//testing the value returned correctly
Response.Write(myId);
SqlCommand cmd = new SqlCommand("insert into rply(task_id,comment,rply_name,rpl_date)values('" + myId + "','" + btnModify.Text + "','" + s2 + "','" + DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + "')", c);
c.Open();
cmd.ExecuteNonQuery();
c.Close();
}
Reply
Answers (
2
)
simple MVC app in a single view for multiple actions
Problem using ajax ModalPopupExtender with UpdatePanel