Custom Server Controlshttp://forums.asp.net/19.aspx/1?Custom+Server+ControlsAll about building ASP.NET server controls.Fri, 05 Apr 2013 10:47:21 -0400urn:uuid:00000000-0000-0000-0000-000000000019urn:uuid:00000000-0000-0000-0000-000005384301http://forums.asp.net/p/1903786/5384301.aspx/1?Extending+a+controlExtending a control <p>I extended an Image Button Control and I compiled the dll and then added it to my toolbox... when I try to drag the control over to the designer of&nbsp;new project it dings for an error.</p> <p>&nbsp;</p> <p>when I drag it into source we see the problem:</p> <pre class="prettyprint">&lt;cc1:NewImageButtonControl ID=&quot;NewImageButtonControl2&quot; runat=&quot;server&quot;&gt;&lt;/cc1:ServerControl1&gt;</pre> <p>What did I forget to do to make it do the close tag correctly?</p> <p>I have above the class</p> <pre class="prettyprint">ToolboxData("&lt;{0}:NewImageButtonControl runat=server&gt;&lt;/{0}:NewImageButtonControl&gt;")]</pre> <p>Isn't that what's supposed to control that?</p> <p>The only thing I'm overriding is the OnClick. The rest is using the standard.</p> 2013-05-04T16:29:12-04:002013-05-04T16:29:12.713-04:00urn:uuid:00000000-0000-0000-0000-000005382247http://forums.asp.net/p/1903294/5382247.aspx/1?How+to+persist+a+control+in+a+custom+BoundField+How to persist a control in a custom BoundField ? <p>Hello everyone !</p> <p>I have a custom BoundField (GridView column) in order to add a filter textbox on some columns. The textbox is well added and displayed, and the textChanged event is well fired. But my problem is that the control is not persisted (I lost the text value on each postback), which seems me logic because the control is re-created at every postback.</p> <p>How could I do this ?</p> <p>Here is my code (simplified):</p> <pre class="prettyprint">public class Column : BoundField { public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex) { base.InitializeCell(cell, cellType, rowState, rowIndex); if (cellType == DataControlCellType.Footer) { TextBox txtFilter = new TextBox(); txtFilter.Text = &quot;&quot;; txtFilter.AutoPostBack = true; txtFilter.TextChanged &#43;= new EventHandler(txtFilter_TextChanged); cell.Controls.Add(txtFilter); } } protected void txtFilter_TextChanged(object sender, EventArgs e) { } }</pre> <p><br> <br> </p> 2013-05-02T13:41:08-04:002013-05-02T13:41:08.627-04:00urn:uuid:00000000-0000-0000-0000-000003736779http://forums.asp.net/p/1537329/3736779.aspx/1?custom+control+custom control <p>when i register my custom control on the second line of the aspx page, the first line gives me error that name space in the imports doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.??????????</p> 2010-03-17T21:36:31-04:002010-03-17T21:36:31.23-04:00urn:uuid:00000000-0000-0000-0000-000005367063http://forums.asp.net/p/1899778/5367063.aspx/1?Text+Captcha+works+fine+on+localhost+but+not+on+web+serverText Captcha works fine on localhost but not on web server <p>Hello everyone,</p> <p>I am trying to use a custom Text Captcha inside a UpdatePanel.<em>&nbsp;</em>It works fine on localhost, but when I deploy it to the webserver it is not displaying. I am using VS 2010 - vb.net for&nbsp;code and asp.net&nbsp;4.0 and IIS 6.0 is on the webserver. Here is my code:</p> <pre class="prettyprint">&lt;%@ Page Language=&quot;vb&quot; AutoEventWireup=&quot;false&quot; CodeBehind=&quot;MessageBoard.aspx.vb&quot; Inherits=&quot;ContractApplicationPublic.MessageBoard&quot; %&gt; &lt;%@ Register Assembly=&quot;AjaxControlToolkit&quot; Namespace=&quot;AjaxControlToolkit&quot; TagPrefix=&quot;asp&quot; %&gt; &lt;%@Import Namespace=&quot;System.Data&quot; %&gt; &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt; &lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&gt; &lt;title&gt;MWRDGC Contract Application&lt;/title&gt; &lt;link href=&quot;css/xmlMessageBoard.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt; &lt;style type=&quot;text/css&quot;&gt; .style2 { color: #69ACD2; font-weight: bold; border-left-color: #9D9DA1; border-right-color: #C0C0C0; border-top-color: #9D9DA1; border-bottom-color: #C0C0C0; padding: 4px; background-color: #FFFFFF; } .style3 { font-size: small; font-weight: bold; background-color: #FFFFFF; } .style4 { font-weight: bold; } .style5 { font-size: small; } .style6 { color: #3366FF; font-weight: bold; border-left-color: #9D9DA1; border-right-color: #C0C0C0; border-top-color: #9D9DA1; border-bottom-color: #C0C0C0; padding: 4px; } .style7 { background-color: #FFFFFF; } .style8 { font-size: small; background-color: #FFFFFF; } .style10 { width: 94px; } .style11 { width: 100%; } .style12 { height: 24px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt; &lt;div id=&quot;PageHeading&quot;&gt;MWRDGC Contract Question Board&lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;script src=&quot;Scripts/jquery-1.4.1.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;table class=&quot;style11&quot;&gt; &lt;tr&gt; &lt;td class=&quot;style12&quot;&gt; &lt;asp:Label ID=&quot;Label2&quot; runat=&quot;server&quot; ForeColor=&quot;#0B73B5&quot; Text=&quot;Contract Number:&quot; Font-Bold=&quot;True&quot; Font-Size=&quot;Medium&quot; style=&quot;text-align: left&quot;&gt;&lt;/asp:Label&gt; &lt;asp:Label ID=&quot;lblContractNumber&quot; runat=&quot;server&quot; ForeColor=&quot;Black&quot; Font-Size=&quot;Medium&quot;&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID=&quot;Label3&quot; runat=&quot;server&quot; ForeColor=&quot;#0B73B5&quot; Text=&quot;Contract Description:&quot; Font-Bold=&quot;True&quot; Font-Size=&quot;Medium&quot;&gt;&lt;/asp:Label&gt; &lt;asp:Label ID=&quot;lblContractDescription&quot; runat=&quot;server&quot; ForeColor=&quot;Black&quot; Font-Size=&quot;Medium&quot;&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;asp:UpdatePanel ID=&quot;UpdatePanel1&quot; runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot;&gt; &lt;ContentTemplate&gt; &lt;div id=&quot;CommentForm&quot;&gt; &lt;center&gt; &lt;table&gt; &lt;tr&gt; &lt;td valign=&quot;top&quot; align=&quot;left&quot; class=&quot;style10&quot;&gt;Your Question:&lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID=&quot;txtQuestion&quot; runat=&quot;server&quot; Width=&quot;350&quot; CssClass=&quot;CommentInputBox&quot; Height=&quot;71px&quot; TextMode=&quot;MultiLine&quot; /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign=&quot;top&quot; align=&quot;left&quot; class=&quot;style10&quot;&gt; &amp;nbsp;&lt;/td&gt; &lt;td&gt; &amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign=&quot;top&quot; align=&quot;left&quot; class=&quot;style10&quot;&gt; &amp;nbsp;&lt;/td&gt; &lt;td&gt; &lt;div id=&quot;CaptchaLabel&quot;&gt; &lt;asp:Image ID=&quot;lblResult&quot; runat=&quot;server&quot; ImageUrl=&quot;GetImage.aspx&quot; ImageAlign=&quot;Left&quot; AlternateText=&quot;&quot; /&gt; &lt;/div&gt; &lt;div id=&quot;CaptchaVerify&quot;&gt; Verification Number&lt;br /&gt; &lt;asp:TextBox ID=&quot;txtCaptcha&quot; runat=&quot;server&quot; Width=&quot;120&quot; CssClass=&quot;CommentInputBox&quot; /&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align=&quot;right&quot; colspan=&quot;2&quot; class=&quot;BottomCell&quot;&gt; &lt;asp:Button ID=&quot;bttSubmitQuestion&quot; runat=&quot;server&quot; Text=&quot;Submit Question&quot; OnClick=&quot;bttSubmitQuestion_Click&quot; CssClass=&quot;CommentButton&quot; onclientclick=&quot;return confirm('Are you sure you want to SUBMIT the current question?');return false;&quot; /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/center&gt; &lt;/div&gt; &lt;asp:DataList ID=&quot;DataList1&quot; runat=&quot;server&quot; RepeatLayout=&quot;Flow&quot;&gt; &lt;ItemTemplate&gt; &lt;span class=&quot;style6&quot;&gt;Question:&lt;/span&gt; &lt;asp:Label ID=&quot;PostQuestionLabel&quot; runat=&quot;server&quot; Text='&lt;%# Eval(&quot;PostQuestion&quot;) %&gt;' /&gt; &lt;br /&gt; &lt;br /&gt; Posted By: User&lt;br /&gt;Posted on: &lt;asp:Label ID=&quot;PostDateTimeLabel&quot; runat=&quot;server&quot; Text='&lt;%# Eval(&quot;PostDateTime&quot;) %&gt;' /&gt; &lt;br /&gt; &lt;asp:Image ID=&quot;Image3&quot; runat=&quot;server&quot; ForeColor=&quot;#0B73B5&quot; ImageUrl=&quot;~/Images/Horizontal_Line.jpg&quot; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;span class=&quot;style2&quot;&gt;Question Reply:&lt;/span&gt; &lt;asp:Label ID=&quot;CommentMessageLabel&quot; runat=&quot;server&quot; Text='&lt;%# Eval(&quot;CommentMessage&quot;) %&gt;' /&gt; &lt;br /&gt; &lt;br /&gt; Posted By: Administrator&lt;br /&gt;Posted On: &lt;asp:Label ID=&quot;CommentDateTimeLabel&quot; runat=&quot;server&quot; Text='&lt;%# Eval(&quot;CommentDateTime&quot;) %&gt;' /&gt; &lt;br /&gt; &lt;br /&gt; &lt;/ItemTemplate&gt; &lt;/asp:DataList&gt; &lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot; EnablePartialRendering=&quot;true&quot; /&gt; &lt;asp:Label ID=&quot;lblCompanyID&quot; runat=&quot;server&quot; Visible=&quot;False&quot;&gt;&lt;/asp:Label&gt; &amp;nbsp;&lt;asp:Label ID=&quot;lblContractID&quot; runat=&quot;server&quot; Visible=&quot;False&quot;&gt;&lt;/asp:Label&gt; &lt;asp:Label ID=&quot;lblUserName&quot; runat=&quot;server&quot; Visible=&quot;False&quot;&gt;&lt;/asp:Label&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:UpdateProgress ID=&quot;UpdateProgress1&quot; runat=&quot;server&quot;&gt; &lt;ProgressTemplate&gt; &lt;div id=&quot;ProgressBar&quot; style=&quot;top: 150px;&quot;&gt; &lt;img alt=&quot;Loading&quot; src=&quot;images/ajax-loader.gif&quot; style=&quot;width: 32px; height: 32px&quot; /&gt; &lt;/div&gt; &lt;/ProgressTemplate&gt; &lt;/asp:UpdateProgress&gt; &amp;nbsp;&lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> <pre class="prettyprint">Private Function GenerateRandomCode() As String 'Generate a random number for the CAPTCHA image Dim s As String = "" For i As Integer = 0 To 5 s = s + Me.rand.Next(10).ToString() Next Return s End Function Public Sub SetCaptcha() 'Create a new captcha image Me.Session("CaptchaImageText") = GenerateRandomCode() 'append current date to image url to assure loading of new image Me.lblResult.ImageUrl = "GetImage.aspx?" + DateTime.Now.ToString() End Sub Partial Class GetImage Inherits System.Web.UI.Page Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.Cache.SetCacheability(HttpCacheability.NoCache) 'Create a CAPTCHA image using the text stored in the Session object. Dim ci As New CaptchaImage.CaptchaImage(Me.Session("CaptchaImageText"), 200, 50, "Century Schoolbook") Me.Response.Clear() Me.Response.ContentType = "image/png" ci.Image.Save(Me.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) ci.Dispose() End Sub End Class</pre> <p>also have attached to project a CaptchaImage.dll</p> <p>&nbsp;</p> <p>&nbsp;</p> 2013-04-17T15:35:30-04:002013-04-17T15:35:30.71-04:00urn:uuid:00000000-0000-0000-0000-000005378694http://forums.asp.net/p/1902526/5378694.aspx/1?User+Control+Dynamic+PropertiesUser Control - Dynamic Properties <p>I have a property for my userControl called DocID:<br> private int mDocID;<br> public int DocID<br> {<br> <span id="yui_3_7_2_1_1367241395125_8194" class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>get { return mDocID; }<br> &nbsp;&nbsp;&nbsp; set { mDocID = value; }<br> }<br> <br> What is happening is:&nbsp; in my &quot;Page_Load&quot; for the user control, I am not able to get the DocID.&nbsp; When I define the UserControl, the DocID is dynamic and dependent upon values inside a GridView.&nbsp; When a user clicks the &quot;Edit / View&quot; link inside the gridview, it is supposed to load an AJAX.ModalExtenderPopup (here is the code inside the GridView, which technically loads the UserControl, but I am unable to get the DocID to pass.&nbsp; <br> &lt;asp:GridView <br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>ID=&quot;gvSectionV&quot;&gt; <br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;Columns&gt; <br> &nbsp;&nbsp;&nbsp; <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;asp:TemplateField&gt; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="yui_3_7_2_1_1367241395125_8200" class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span> &lt;ItemTemplate&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;asp:LinkButton <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="yui_3_7_2_1_1367241395125_8203" class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>ID=&quot;lbEdit_SectionV&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Text=&quot;Edit / View&quot; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnClick=&quot;lbEdit_SectionV_Click&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CausesValidation=&quot;false&quot; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CommandArgument='&lt;%# Eval(&quot;DocID&quot;) %&gt;' <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CommandName=&quot;EditView&quot; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runat=&quot;server&quot;&gt;<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span><span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span> <span id="yui_3_7_2_1_1367241395125_8201" class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;/asp:LinkButton&gt;<br> <br> After the GridView, I am creating the ModalPopupExtender as follows:<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;asp:Button ID=&quot;btnPartControlPopup_SectionV&quot; runat=&quot;server&quot; style=&quot;display:none&quot; /&gt;<br> &nbsp;&nbsp;&nbsp; &lt;ajaxToolKit:ModalPopupExtender <br> &nbsp;&nbsp;&nbsp; <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>ID=&quot;mdlPartControlPopup_SectionV&quot;&nbsp; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TargetControlID=&quot;btnPartControlPopup_SectionV&quot; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PopupControlID=&quot;pnlPartControlPopup_SectionV&quot; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CancelControlID=&quot;btnPartControlClose_SectionV&quot; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RepositionMode=&quot;RepositionOnWindowResizeAndScroll&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BackgroundCssClass=&quot;modalBackground&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runat=&quot;server&quot; /&gt;<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;asp:Panel ID=&quot;pnlPartControlPopup_SectionV&quot; CssClass=&quot;scrollableModalWindow&quot; runat=&quot;server&quot;&gt;<br> &nbsp;&nbsp;&nbsp; <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;table border=&quot;0&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;tr&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;td class=&quot;label&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;uc1:PartDetail ID=&quot;ucPartDetailControl&quot; MaintenanceType=&quot;M&quot; runat=&quot;server&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt;<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span><span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;/tr&gt;<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span><span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp;&nbsp; </span> <span id="yui_3_7_2_1_1367241395125_8202" class="yiv8326161595tab">&lt;/table&gt;</span><br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>&lt;/asp:Panel&gt;<br> <br> I tried to set the ucPartDetailControl on the Gridview_RowDataBound event, but that doesn't do it.&nbsp; Well, technically, it is being set but when the link is clicked, it doesn't have this value (see code below on how I am setting it).&nbsp; I think I know the reason why, but can't quite seem to type my thoughts on it.&nbsp; <br> <br> if (e.Row.RowType == DataControlRowType.DataRow)<br> {<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>if ((e.Row.RowState &amp; DataControlRowState.Edit) &gt; 0)<br> &nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp; <span id="yui_3_7_2_1_1367241395125_8206" class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span> //&nbsp; Do Nothing<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>}<br> &nbsp;&nbsp;&nbsp; else<br> &nbsp;&nbsp;&nbsp; {<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span><span id="yui_3_7_2_1_1367241395125_8205" class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>Part row = (Part)e.Row.DataItem;<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span><span id="yui_3_7_2_1_1367241395125_8204" class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>ucPartDetailControl.DocRegisterID = row.DocRegisterID;<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="yiv8326161595tab"></span>} <br> }<br> <br> I also tried to set it on the &quot;lbEdit_SectionV_Click&quot; event, but this value is set after the UserControl's Page_Load event has fired, so it does me no good.&nbsp; <br> protected void lbEdit_SectionV_Click(object sender, EventArgs e)<br> {<br> <span class="yiv8326161595tab">&nbsp;&nbsp;&nbsp; </span>ucPartDetailControl.DocID = 123;<br> &nbsp;&nbsp;&nbsp; mdlPartControlPopup_SectionV.Show();<br> }<br> <br> Any help is greatly appreciated.<br> <br> Thanks<br> Andy</p> 2013-04-29T14:20:53-04:002013-04-29T14:20:53.97-04:00urn:uuid:00000000-0000-0000-0000-000005368608http://forums.asp.net/p/1900146/5368608.aspx/1?Custom+control+not+working+under+IE+10Custom control not working under IE 10 <p>Hello,</p> <p>We have a website with a custom calendar contol (ascx file).&nbsp; This custom control is a combination of the following asp controls:&nbsp; Textbox, ImageButton, Panel, Calendar, RequiredFieldValidator, RegularExpressionValidator, and RangeValidator.&nbsp; While doing testing for IE 10, it was discovered that this custom control wasn't working any more.&nbsp; After some research and examination of the site with Fiddler, it turns out there might be some sort of Javascript issue.&nbsp; In the webforms section of Fiddler, the values for ctl00&#36;BaseContentArea&#36;txtDOB&#36;btnShowCalendar.x and .y values are now decimals.&nbsp; When I place the website under compatibility view, those .x and .y values are integers and the custom control works.&nbsp; The differences in the x and y values seem to come from the ImageButton control.&nbsp; Was there some sort of change with the ImageButton and IE10?</p> 2013-04-18T20:37:15-04:002013-04-18T20:37:15.03-04:00urn:uuid:00000000-0000-0000-0000-000005371996http://forums.asp.net/p/1900966/5371996.aspx/1?Some+queries+about+TypeConverterSome queries about TypeConverter <p>Hi guys,</p> <p>I made a server control. And I implemented a TypeConverter for a complexity property. I don't really understand where some code in TypeConverter will be invoked.</p> <pre class="prettyprint">public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)</pre> <p>1.Who will invoke the method ConvertTo()?</p> <p>2.In which situation the parameter destinationType will be InstanceDescriptor? And when will it be String?</p> <p>Have a strong desire to know the answer, please help!</p> 2013-04-23T04:46:07-04:002013-04-23T04:46:07.637-04:00urn:uuid:00000000-0000-0000-0000-000005363632http://forums.asp.net/p/1898995/5363632.aspx/1?Can+I+use+custom+JavaScript+instead+of+ASP+NET+AJAX+Can I use custom JavaScript instead of ASP.NET AJAX? <p>I am developing a custom server control that is tightly integrated with DB. I am using Visual Studio 2008 SP1 to create the (custom) server control. Of course, I need JavaScript and I can write my own JS code. However, my question is: Will I be forced to use ASP.NET AJAX? I mean the client-side AJAX component which ASP.NET provides. I have seen that code and it uses some objects like Sys, etc.</p> 2013-04-15T02:05:24-04:002013-04-15T02:05:24.103-04:00urn:uuid:00000000-0000-0000-0000-000004606217http://forums.asp.net/p/1722642/4606217.aspx/1?+how+to+upload+multiple+files+at+a+time+ how to upload multiple files at a time? <p>how can we upload multiple files at a time...</p> <p></p> <p>my requirement is, when i click on browse buttton, i shud be able to select multiple images at a time, not clicking browse button every time for every image nd uploading all at once</p> <p>then i shud be able to use upload button, i want event handler in upload button</p> <p>lot of application in net are using flash buttons for uploading button, or clicking on browse button every time for selecting every image, or when we select multiple images, directly they are getting uploaded with the use of upload button...</p> <p></p> <p>thanks in advance</p> 2011-09-21T04:42:22-04:002011-09-21T04:42:22.91-04:00urn:uuid:00000000-0000-0000-0000-000005360747http://forums.asp.net/p/1897524/5360747.aspx/1?Any+free+or+How+to+build+a+dropdown+calendar+controlAny free or How to build a dropdown calendar control <p>Dear all,</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am using Calendar control is asp.net project built by C# 2010. But the calendar control is a retangle, so I want it to be a dropdown to let user selected date when in need. How can I do that? Or there exist any third party commercial calendar control? Thanks.</p> <p>&nbsp;</p> 2013-04-12T06:25:41-04:002013-04-12T06:25:41.82-04:00urn:uuid:00000000-0000-0000-0000-000005354154http://forums.asp.net/p/1895786/5354154.aspx/1?Custom+control+propertiesCustom control properties <p>Hi<br> <br> I have a custom control that I have created with a bunch standard windows asp controls on it.<br> <br> Question.<br> <br> Is it possible to inherit the properties of the parent control into the custom control without re-inventing the wheel?<br> <br> So for example I have a control with a button a text-box and a label.<br> <br> Normally I can access the properties of that control via Lable1.Text however when these controls are places within a custom control how do I access them without encapsulating all the properties of that control individually.<br> <br> I was hoping for something like CustomControl1.Lable1.Text or is this not possible<br> <br> Many thanks</p> 2013-04-05T14:47:21-04:002013-04-05T14:47:21.787-04:00urn:uuid:00000000-0000-0000-0000-000005350775http://forums.asp.net/p/1894981/5350775.aspx/1?ListItems+attributes+in+a+DropDownList+are+lost+after+postback+ListItems attributes in a DropDownList are lost after postback? <p>I have manually add some addition attirubte during dropdownlist databound event. However, after postback the attribute is missing. And i found related issue at&nbsp;<a href="http://stackoverflow.com/questions/1313447/listitems-attributes-in-a-dropdownlist-are-lost-on-postback?answertab=active#tab-top">ListItems attributes in a DropDownList are lost on postback?</a>&nbsp;and i follow exactly the solution.</p> <p>This is what i have</p> <p>Dropdownlist databound event *.aspx.vb, I add in addition attribute &quot;class&quot; into every listitem</p> <p></p> <pre class="prettyprint">Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ddlCountry.DataBind() End If End Sub Protected Sub ddlCountry_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlCountry.DataBound Dim ddlCountryList As DropDownList = LocationBLL.GetDropDownList(&quot;Country&quot;, &quot;C&quot;, &quot;C&quot;, False, &quot;&quot;) Dim lstPleaseSelect As ListItem = New ListItem(&quot;Please Select&quot;, &quot;-1&quot;) Dim lstOthers As ListItem = New ListItem(&quot;Others&quot;, &quot;0&quot;) lstPleaseSelect.Attributes(&quot;class&quot;) = &quot;-1&quot; lstOthers.Attributes(&quot;class&quot;) = &quot;-1&quot; ddlCountry.Items.Add(lstPleaseSelect) For Each lstItem As ListItem In ddlCountryList.Items lstItem.Attributes(&quot;class&quot;) = lstItem.Value ddlCountry.Items.Add(lstItem) Next ddlCountry.Items.Add(lstOthers) End Sub</pre> <p><span>*.aspx</span></p> <pre class="prettyprint">&lt;%@ Register TagPrefix="msjNewControls" Namespace="NewControls"%&gt; </pre> <pre class="prettyprint">&lt;msjNewControls:NewDropDownList ID="ddlCountry" runat="server" AutoPostBack="False" &gt; &lt;/msjNewControls:NewDropDownList&gt;</pre> <p><span>class file *.vb</span></p> <pre class="prettyprint">Imports System.Collections.Generic Imports System.ComponentModel Imports System.Security.Permissions Imports System.Linq Imports System.Text Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Namespace NewControls &lt;DefaultProperty("Text")&gt; _ &lt;ToolboxData("&lt;{0}:ServerControl1 runat=server&gt;&lt;/{0}:ServerControl1&gt;")&gt; _ Public Class NewDropDownList Inherits DropDownList &lt;Bindable(True)&gt; _ &lt;Category("Appearance")&gt; _ &lt;DefaultValue("")&gt; _ &lt;Localizable(True)&gt; _ Protected Overrides Function SaveViewState() As Object ' create object array for Item count + 1 Dim allStates As Object() = New Object(Me.Items.Count) {} ' the +1 is to hold the base info Dim baseState As Object = MyBase.SaveViewState() allStates(0) = baseState Dim i As Int32 = 1 ' now loop through and save each Style attribute for the List For Each li As ListItem In Me.Items Dim j As Int32 = 0 Dim attributes As String()() = New String(li.Attributes.Count - 1)() {} For Each attribute As String In li.Attributes.Keys attributes(System.Math.Max(System.Threading.Interlocked.Increment(j), j - 1)) = New String() {attribute, li.Attributes(attribute)} Next allStates(System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)) = attributes Next Return allStates End Function Protected Overrides Sub LoadViewState(ByVal savedState As Object) If savedState IsNot Nothing Then Dim myState As Object() = DirectCast(savedState, Object()) ' restore base first If myState(0) IsNot Nothing Then MyBase.LoadViewState(myState(0)) End If Dim i As Int32 = 1 For Each li As ListItem In Me.Items ' loop through and restore each style attribute For Each attribute As String() In DirectCast(myState(System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)), String()()) li.Attributes(attribute(0)) = attribute(1) Next Next End If End Sub End Class End Namespace</pre> <p><span>However i still received below error in my class file.</span></p> <pre class="lang-vb prettyprint prettyprinted"><pre class="prettyprint"><span class="pln">Exception Details</span><span class="pun">:</span><span class="pln"> System</span><span class="pun">.</span><span class="pln">InvalidCastException</span><span class="pun">:</span><span class="pln"> Unable </span><span class="kwd">to</span><span class="pln"> cast </span><span class="kwd">object</span><span class="pln"> of type </span><span class="com">'System.Collections.DictionaryEntry' to type 'System.Web.UI.WebControls.ListItem'.</span><span class="pln">&nbsp;</span></pre></pre> <pre class="lang-vb prettyprint prettyprinted"><pre class="prettyprint"><span class="pln">Source </span><span class="kwd">Error</span><span class="pun">:</span><span class="pln"> Line </span><span class="lit">34</span><span class="pun">:</span><span class="pln"> attributes</span><span class="pun">(</span><span class="pln">System</span><span class="pun">.</span><span class="pln">Math</span><span class="pun">.</span><span class="pln">Max</span><span class="pun">(</span><span class="pln">System</span><span class="pun">.</span><span class="pln">Threading</span><span class="pun">.</span><span class="pln">Interlocked</span><span class="pun">.</span><span class="pln">Increment</span><span class="pun">(</span><span class="pln">j</span><span class="pun">),</span><span class="pln"> j </span><span class="pun">-</span><span class="pln"> </span><span class="lit">1</span><span class="pun">))</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">New</span><span class="pln"> </span><span class="kwd">String</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">attribute</span><span class="pun">,</span><span class="pln"> li</span><span class="pun">.</span><span class="pln">Attributes</span><span class="pun">(</span><span class="pln">attribute</span><span class="pun">)}</span><span class="pln">&nbsp;</span></pre></pre> <pre class="lang-vb prettyprint prettyprinted"><pre class="prettyprint"><span class="pln">Source File</span><span class="pun">:</span><span class="pln"> D</span><span class="pun">:\</span><span class="pln">root</span><span class="pun">\</span><span class="pln">App_Code</span><span class="pun">\</span><span class="pln">BLL</span><span class="pun">\</span><span class="pln">CustomDropDownListBLL</span><span class="pun">.</span><span class="pln">vb Line</span><span class="pun">:</span><span class="pln"> </span><span class="lit">34</span><span class="pln"> </span></pre></pre> <p><br> <br> <br> <br> </p> 2013-04-03T01:25:10-04:002013-04-03T01:25:10.59-04:00urn:uuid:00000000-0000-0000-0000-000001158853http://forums.asp.net/p/950921/1158853.aspx/1?custom+treeview+with+populate+on+demandcustom treeview with populate on demand <p>Hi,</p> <p>I've added an additinal control to the treeview similar to what has been displayed in the&nbsp;the&nbsp;following blog:</p> <p><a href="http://fredrik.nsquared2.com/viewpost.aspx?PostID=299">http://fredrik.nsquared2.com/viewpost.aspx?PostID=299</a></p> <p>It works fine as it is but when I try to use the same with &quot;populate nodes from client&quot;, I get an error message in place of the treenode text which says &quot;Object reference not set to an instance of an object.&quot;</p> <p>If I remove the CreateNode override then the populate node from the client&nbsp;works fine but this time the additional control is not rendered on the postbacks. </p> <p>Any ideas how to make this work with the client side node population. </p> <p>thanks</p> 2006-01-04T15:53:03-05:002006-01-04T15:53:03.257-05:00urn:uuid:00000000-0000-0000-0000-000005324070http://forums.asp.net/p/1887794/5324070.aspx/1?How+to+implement+ItemType+functionality+in+custom+controlsHow to implement ItemType functionality in custom controls <p>Hi,&nbsp;</p> <p>asp.net 4.5 added support for strongly typed binding in itemtemplates by specifiying the itemtype property.</p> <p>I was wondering how one can create a custom templated control/usercontrol and have support for itemtype?</p> 2013-03-06T22:52:50-05:002013-03-06T22:52:50.02-05:00urn:uuid:00000000-0000-0000-0000-000005338763http://forums.asp.net/p/1892120/5338763.aspx/1?How+to+Best+Include+Script+ElementHow to Best Include Script Element <p>Hi, everyone!</p> <p>I was hoping for some advice. If I want to include some JavaScript to be rendered with my Server Control. What's the best way to do this?</p> <p>I know the simplest is to add it as a literal, but would it be best to read an external JS file into my control? Would that add significantly to the rendering time?</p> <p>Any thoughts would be appreciated.</p> <p>Thanks!</p> <p>-Eric</p> 2013-03-21T00:38:57-04:002013-03-21T00:38:57.957-04:00urn:uuid:00000000-0000-0000-0000-000005323633http://forums.asp.net/p/1887686/5323633.aspx/1?Web+Control+Library+Embedded+Stylesheet+And+WebConfig+themeWeb Control Library Embedded Stylesheet And WebConfig theme <p>Hi,</p> <p>I have one control library which built runtime custom infobox control.</p> <p>There is one CSS file embedded in this control library which works properly for my few modules.&nbsp; But, in one of my module it loads WebResource.axd in the client browser but unable to apply classes over any control. I have opened AXD file and all the defined classes exists.&nbsp;</p> <p>Then, I found the root cause of this issue. In my this project we use page theme in the web.config file, where this embeded css file doesnt work.</p> <p>&lt;pages theme=&quot;Default&quot; validateRequest=&quot;true&quot;&gt;</p> <p>When I remove this tag from my web.config file, hence its started applying all the declared classes under embeded css file.</p> <p>Please help me on this. How can I get rid of this kind of problem.</p> 2013-03-06T12:57:04-05:002013-03-06T12:57:04.163-05:00urn:uuid:00000000-0000-0000-0000-000004020195http://forums.asp.net/p/1588773/4020195.aspx/1?+Type+ASP+x+is+not+defined+error+for+dynamic+user+control+when+publishing+updateable"Type ASP.x is not defined" error for dynamic user control when publishing updateable <p>I have a user control (ContainerCtrl) which programmatically instantiates another user control (SimpleCtrl) in OnLoad. It builds and runs fine, but when I publish it I get the error &quot;error BC30002: Type 'ASP.SimpleCtrl' is not defined.&quot; (If I publish without the &quot;updateable&quot; option there's no error, but I need the site to be updateable.) </p> <p>I assume this has to do with the particulars of how the assembly(ies) are built for the different compiler options. My question is, how can I get it to work properly for &quot;updateable&quot; publishing?<br> </p> <p>VS 2008 / .NET 3.5 sp1<br> </p> <p>The code follows (web.config is the default from Visual Studio).</p> <p>Many thanks, Dave</p> <p>SimpleCtrl.aspx------------------------------</p> <p>&lt;%@ Control Language=&quot;VB&quot; ClassName=&quot;SimpleCtrl&quot; CodeFile=&quot;SimpleCtrl.ascx.vb&quot; Inherits=&quot;_SimpleCtrl&quot; %&gt;<br> <br> &lt;div&gt;<br> &nbsp;&nbsp;&nbsp; Simple control<br> &lt;/div&gt;</p> <p>SimpleCtrl.aspx.vb------------------------------</p> <p>Partial Class _SimpleCtrl<br> &nbsp;&nbsp;&nbsp; Inherits UserControl<br> <br> &nbsp;&nbsp;&nbsp; 'Nothing to see here.<br> <br> End Class</p> <p>ContainerCtrl.aspx------------------------------</p> <p>&lt;%@ Control Language=&quot;VB&quot; CodeFile=&quot;ContainerCtrl.ascx.vb&quot; Inherits=&quot;_ContainerCtrl&quot; %&gt;<br> &lt;%@ Reference Control=&quot;~/SimpleCtrl.ascx&quot; %&gt;<br> <br> &lt;asp:Panel runat=&quot;server&quot; ID=&quot;Panel1&quot; /&gt;</p> <p>ContainerCtrl.aspx.vb------------------------------</p> <p>Partial Class _ContainerCtrl<br> &nbsp;&nbsp;&nbsp; Inherits UserControl<br> <br> &nbsp;&nbsp;&nbsp; Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim simple As New ASP.SimpleCtrl 'THIS IS THE LINE THE COMPILER DISLIKES<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Panel1.Controls.Add(simple)<br> &nbsp;&nbsp;&nbsp; End Sub<br> <br> End Class</p> <p>Error---------------------------</p> <p>C:\...\TypeNotFoundTest\ContainerCtrl.ascx.vb(6,0): error BC30002: Type 'ASP.SimpleCtrl' is not defined.</p> 2010-08-10T18:37:40-04:002010-08-10T18:37:40.193-04:00urn:uuid:00000000-0000-0000-0000-000005306940http://forums.asp.net/p/1883789/5306940.aspx/1?How+to+create+many+Tags+in+one+tag+using+webcontrol+in+asp+netHow to create many Tags in one tag using webcontrol in asp.net &lt;div class=&quot;body&quot;&gt; <p>Hi,</p> <p>I want to create a <strong>custom webcontrol</strong> that I can use it like below:</p> <pre class="prettyprint">&lt;myControls:MyGraph id=&quot;myGraph1&quot; runat=&quot;server&quot;&gt; &lt;Colors&gt; &lt;myControls:ColorD Value=&quot;#abcdef&quot; /&gt; &lt;myControls:Color&gt; Blue &lt;/myControls:Color&gt; &lt;myControls:ColorD Value=&quot;#1ad234&quot; /&gt; &lt;myControls:ColorD Value=&quot;#123456&quot; /&gt; &lt;/Colors&gt; &lt;/myControls:MyGraph&gt;</pre> <p>I mean, I want to get many tags &lt;Color&gt;, &lt;ColorD&gt; in only one tag: &lt;Colors&gt; tag, and get the order of them too.</p> <p>May Someone help me, please.</p> <p>Thanks and best regards,</p> <p>Nguyen DC.</p> &lt;/div&gt; 2013-02-19T11:10:07-05:002013-02-19T11:10:07.213-05:00urn:uuid:00000000-0000-0000-0000-000004553815http://forums.asp.net/p/1710620/4553815.aspx/1?How+to+custom+ListViewHow to custom ListView <p>I want to create a custom ListView control with flexibility of Templates, sorting and paging. Please help me!</p> <p>Thanks in advance!</p> 2011-08-15T06:06:58-04:002011-08-15T06:06:58.313-04:00urn:uuid:00000000-0000-0000-0000-000005285347http://forums.asp.net/p/1878684/5285347.aspx/1?Costum+popup+boxCostum popup box <p>Hey</p> <p>I am trying to make a costum popup where I can add controls and funktions on, and it need to be connectet to a webpage so that when I make som changes in the box and closes it, it will update the webpage and if a have the box open and go to an other page it will close the box.</p> <p>is there any one that have a ide on how to do it.</p> 2013-01-29T12:21:59-05:002013-01-29T12:21:59.79-05:00