Jul 07, 2010, 10:16 PM
[CLOSED] [1.0] Mandatory field indicator on textfield within FormPanel
I have created a custom textfield control which inherits from Ext.Net.TextField. This control will be used in an Ext.Net.FormPanel. The problem I have is that if I drop the control into a Ext.Net.Panel it works fine but if I put the control in a form panel the mandatory field indicator (*) is rendered outside the FormPanel.
Here is a sample page:
Here is a sample page:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestFormPanel.aspx.vb" Inherits="TestFormPanel" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:FormPanel ID="Panel1" runat="server" Title="Test Panel">
<Content>
<ui:MyTextField ID="txtName" FieldLabel="Name" runat="server" AllowBlank="false"></ui:MyTextField>
</Content>
</ext:FormPanel>
<ui:MyTextField ID="txtName2" FieldLabel="Name2" runat="server" AllowBlank="false"></ui:MyTextField>
</form>
</body>
</html>
And here is the control:Public Class MyTextField
Inherits Ext.Net.TextField
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
If Me.AllowBlank = True Then
MyBase.Render(writer)
Else
writer.WriteLine("<div style='float:left;'>")
MyBase.Render(writer)
writer.WriteLine("</div>")
writer.WriteLine("<div style='padding-left:5px; color: red; font-weight: bold; float:left;'>")
writer.WriteLine("*")
writer.WriteLine("</div>")
writer.WriteLine("<div style='clear:both;'>")
writer.WriteLine("</div>")
End If
End Sub
End Class
Is there a way to incorporate the mandatory field indicator (*) into the ext.net.textfield itself, like the label that precedes it?
Last edited by Daniil; Oct 22, 2010 at 4:40 AM.
Reason: [CLOSED]