Make sure the RoundedCornerExtender is in the same FormView/MultiView as the panel.
-Damien
Hi Nellster,
I have wrote a sample which indicates how to find the Control when it is inside the FormView.
<%@. Page Language="C#" %>
<%@. Import Namespace="AjaxControlToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
protected void Page_Load(object sender, EventArgs e)
{
FormView myFormView;
myFormView = (FormView) this.FindControl("MultiView1").FindControl("EmployeeFormView");
RoundedCornersExtender myRoundedCornersExtender = (RoundedCornersExtender)myFormView.FindControl("RoundedCornersExtender1");
myRoundedCornersExtender.ID = "myRCEBID";
}
</script
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<asp:FormView ID="EmployeeFormView" DataSourceID="EmployeeSource" AllowPaging="true"
DataKeyNames="EmployeeID" EmptyDataText="No employees found." runat="server">
<RowStyle BackColor="LightGreen" Wrap="False" />
<EditRowStyle BackColor="LightBlue" Wrap="False" />
<ItemTemplate>
<table>
<tr>
<td>
<b>Name:</b>
</td>
<td>
<%# Eval("FirstName")%>
<%# Eval("LastName")%>
</td>
</tr>
<tr>
<td>
<b>Title:</b>
</td>
<td>
<%# Eval("Title")%>
</td>
</tr>
</table>
<asp:Panel ID="Panel1" runat="server" Width="330px" CssClass="roundedPanel">
<div style="padding: 10px; text-align: center">
<div style="padding: 5px; border: solid black thin; background-color: #B4B4B4;">
ASP.NET AJAX
</div>
</div>
</asp:Panel>
<ajaxToolkit:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" BehaviorID="RoundedCornersBehavior1"
TargetControlID="Panel1" Radius="6" Corners="All" />
</ItemTemplate>
<EditItemTemplate>
<table>
<tr>
<td rowspan="4">
<asp:Image ID="EmployeeEditImage" ImageUrl='<%# Eval("PhotoPath")%>' AlternateText='<%# Eval("LastName")%>'
runat="server" />
</td>
<td colspan="2">
</td>
</tr>
<tr>
<td>
<b>Name:</b>
</td>
<td>
<asp:TextBox ID="FirstNameUpdateTextBox" Text='<%# Bind("FirstName")%>' runat="server" />
<asp:TextBox ID="LastNameUpdateTextBox" Text='<%# Bind("LastName")%>' runat="server" />
</td>
</tr>
<tr>
<td>
<b>Title:</b>
</td>
<td>
<asp:TextBox ID="TitleUpdateTextBox" Text='<%# Bind("Title")%>' runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:LinkButton ID="UpdateButton" Text="Update" CommandName="Update" runat="server" />
<asp:LinkButton ID="CancelButton" Text="Cancel" CommandName="Cancel" runat="server" />
</td>
</tr>
</table>
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="EmployeeSource" SelectCommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
UpdateCommand="Update [Employees] Set [LastName]=@.LastName, [FirstName]=@.FirstName, [Title]=@.Title Where [EmployeeID]=@.EmployeeID"
ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString%>" runat="server" />
</asp:View>
<asp:View ID="View2" runat="server">
<%=DateTime.Now.ToString()%>
</asp:View>
</asp:MultiView>
</form>
</body>
</html>
I use FindControl("ID") to get the reference.
I hope this help.
Best regards,
Jonathan
No comments:
Post a Comment