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
Uttam Samal
NA
22
0
How to use the controls in Formview Edit or Insert Mode.
Jun 11 2020 6:43 AM
I wanted to use a Dropdown list box in Formview Edit mode, I'm able to add a Dropdownlist now I need to know how do I access the Dropdown list control in code behind. I tried using
DropDownList ddlContractName = (DropDownList)FormView1.Row.FindControl("ddlContractName") but unable to change any properties.
Also I wanted to hide the Edit button in ReadOnly Mode for some users, that did not work out as well (below is the sample)
private void FormView1_DataBound(object sender, System.EventArgs e)
{
if (FormView1.CurrentMode == FormViewMode.ReadOnly)
{
string usrRole = Master.getUserRole(Master.GetLoggedOnUser);
if (usrRole == "Admin")
{
LinkButton linkButton = (LinkButton)FormView1.FindControl("EditButton") as LinkButton;
linkButton.Visible = false;
} else
{
LinkButton linkButton = (LinkButton)FormView1.FindControl("EditButton") as LinkButton;
linkButton.Visible = true;
}
}
}
Reply
Answers (
2
)
how to disable browser back button functionality
using asp.net web API to perform curd operations