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
danish ahmed
NA
8
1.8k
Grid view Button help?
Nov 24 2014 7:51 AM
I am creating web app.
This is a grid view last column has button send message.
When Admin click on send message dynamically a label (to hold emp id),
textbox (to type message), a button (to perform send operation) wil be created.
Problem : Unable to get generate label dynamically to hold emp id on label text.
event : Working on row command event.
Code:
1. Aspx : <asp:ButtonField ButtonType="Button" HeaderText="Message" CommandName="Message" Text="Send Message" />
2. aspx.cs : protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Message")
{
Label lbl = new Label();
lbl.Text = GridView1.SelectedRow.Cells[0].Text; // gets error here i think logic is wrong here //
Panel1.Controls.Add(lbl);
TextBox txtbx = new TextBox();
txtbx.Text = "Enter message for Employee ";
Panel1.Controls.Add(txtbx);
Button btnsubmit = new Button();
btnsubmit.Text = "Send Message ";
Panel1.Controls.Add(btnsubmit);
}
}
Reply
Answers (
2
)
Publish the .net application in command prompt
Query About Storing of data into database using Code first