Label lblDuplicatex = DetailsView1.Rows[0].FindControl("lblDuplicate") as Label;
lblDuplicatex.Text = "Duplicate Folder Name!";
Matt99
When I try to insert a duplicate record the label control does not display the message.
Do you debug your code to check whether there are any error with your code? Besides, please make sure you could find “lblDuplicate” control before you assign the text to lblDuplicatex.
Best Regards,
Fei Han
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.
Member
24 Points
132 Posts
Need help with Displaying message in label control in DetailsView within InsertItem Template
Feb 13, 2016 02:24 PM|Matt99|LINK
Hi all,
I have the following html page:
Code page:
When I try to insert a duplicate record the label control does not display the message.
The code works fine with Response.Write except for findcontrol.
I appreciate any help.
Thanks in advance.
All-Star
50651 Points
9839 Posts
Re: Need help with Displaying message in label control in DetailsView within InsertItem Template
Feb 13, 2016 02:52 PM|A2H|LINK
Try finding the control like given below
Aje
My Blog | Dotnet Funda
Member
24 Points
132 Posts
Re: Need help with Displaying message in label control in DetailsView within InsertItem Template
Feb 13, 2016 04:05 PM|Matt99|LINK
Displaying the message from the label control did not work.
Thanks for trying
Member
24 Points
132 Posts
Re: Need help with Displaying message in label control in DetailsView within InsertItem Template
Feb 14, 2016 06:47 AM|Matt99|LINK
The page content is inside a contentplaceholder I will need to findcontrol inside the contentplaceholder
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
Member
24 Points
132 Posts
Re: Need help with Displaying message in label control in DetailsView within InsertItem Template
Feb 14, 2016 07:53 AM|Matt99|LINK
It is not the content placeholder... But it is the master page is causing the controls not to be detected.
All-Star
39166 Points
5689 Posts
Microsoft
Re: Need help with Displaying message in label control in DetailsView within InsertItem Template
Feb 17, 2016 09:08 AM|Fei Han - MSFT|LINK
Hi Matt99,
Do you debug your code to check whether there are any error with your code? Besides, please make sure you could find “lblDuplicate” control before you assign the text to lblDuplicatex.
Best Regards,
Fei Han
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.