ascx

Retrieving check box name (value) from a table in SQL database into ascx file

余生颓废 提交于 2019-12-11 14:08:52
问题 I have tab names stored in a table named 'Importtabs' in my SQL database. Instead of hard coding the name of tabs i am importing i want to retrieve the names from the above mentioned table and set them as values for my checkbox list on the ascx side. Here is the hardcoded version that i was earlier using: <div style="overflow: auto;"> <asp:CheckBoxList ID="CheckBoxList1" BorderStyle="None" runat="server" RepeatColumns="3"> <asp:ListItem>All Temporary Differences</asp:ListItem> <asp:ListItem

How to implement a C# custom server control?

谁都会走 提交于 2019-12-11 09:27:57
问题 I am trying to implement a custom control using a RowClickableGridView class provided on this Stack Overflow post. This is the first time I have tried to create a custom server control and followed steps laid out in this MSDN walkthrough. I have the RowClickableGridView class in the App\_Code directory of my Web Application Project with a namespace of MyWebApplication.App\_Code , and it compiles. My problem is that the .aspx page that I am trying to use the control on does not recognize the

cant go to the root dirctory in ascx src

非 Y 不嫁゛ 提交于 2019-12-11 09:18:23
问题 I start to build DNN taskMagnager moduel and I need to use the controls in acsx page C:\inetpub\wwwroot\dnndev\controls the problem is that my project folder path is C:\inetpub\wwwroot\dnndev\DesktopModules\TaskManager" and when Im trying to go to path like this: <%@ Register TagPrefix="dnn" TagName="label" **Src="~/controls/lablecontrol.ascx"** %> the src cant be found! No matter what I do its always turns to C:\inetpub\wwwroot\dnndev\DesktopModules\TaskManager\="~/controls/lablecontrol.ascx

Pass a value from aspx to ascx

前提是你 提交于 2019-12-11 09:09:11
问题 I have a web page and it contains an user control inside of it. I have a property on the aspx page which gets set in the pageinit method and I need to that propery on ascx page. How can I get it? 回答1: Create a public property inside the ascx and set it at the same time you set in the aspx page. Just to let you know, PreInit is a EventHandler not a method. 回答2: MyAdminPage myPageInstance = this.Parent as MyAdminPage; if(myPageInstance != null) { ... } There has been a few questions on this.

Gridview Row Events not firing in UserControl

帅比萌擦擦* 提交于 2019-12-11 00:51:47
问题 I've got a pretty strange problem with my usercontrols that I'm working with. I'm coding some user controls to be used in a DotNetNuke module. Basically I have a UserControl on my page that holds some controls and then there is a Placeholder where I am loading in a UserControl that has a GridView placed in it. Basically here is my page structure <asp:Panel runat="server" ID="pnlServiceType" Visible="false"> <uc:ServiceType runat="server" ID="ServiceType" /> </asp:Panel> Within that user

How to check if an image exists in an image control with a handler to display the image

こ雲淡風輕ζ 提交于 2019-12-11 00:06:46
问题 Handler public class Handler2 : IHttpHandler { public void ProcessRequest(HttpContext context) { string id = context.Request.QueryString["Id"]; string constr = System.Configuration.ConfigurationManager .ConnectionStrings["EmployeeDatabase"].ConnectionString; SqlConnection con = new SqlConnection(constr); con.Open(); SqlCommand cmd = new SqlCommand("GetImage", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@EmpID", id); //cmd.Parameters.AddWithValue("@Gender"

How can I have an ascx postback and refresh itself automatically every X seconds?

假如想象 提交于 2019-12-08 04:03:40
问题 I have an ascx control bound to a datasource with frequently changing data. Is there a quick way to have an ascx control postback, rebind and refresh itself every X seconds. The ascx control is in an update panel. 回答1: Use a timer control from the AJAX toolkit since you are already using it: <asp:Timer ID="tmrPolling" runat="server" Interval="10000" ontick="tmrPolling_Tick"></asp:Timer> Add a trigger to your update panel like: <Triggers> <asp:AsyncPostBackTrigger ControlID="tmrPolling"

How do I use an asp.net user control in another user control?

て烟熏妆下的殇ゞ 提交于 2019-12-07 04:41:01
问题 I have a user control ( gallery.ascx ) and I want to use the photo.ascx control in the gallery control. I've added this register at the top of gallery.ascx , but it still can't find photo: <%@ Register TagPrefix="ssctrl" TagName="photo" Src="controls/photo.ascx" %> Any ideas? 回答1: In case anyone is wondering, the Register is correct, my photo user control tag was just not formed properly. I did have it as: <ssctrl:photo ID="Photo" Key="<%# Eval("PageTemplatePK") %>" runat="server" /> and the

Usercontrol losing Viewstate across Postback

*爱你&永不变心* 提交于 2019-12-06 15:53:42
问题 I have a user control which uses objects as inner properties (some code is below). I am having trouble with setting the attribute of the Step class programmatically, when set programmatically it is being lost across postback which would indicate something to do with Viewstate (?). When setting the property of the Step class declaratively it's working fine. Does anybody have any ideas of what this code be/what's causing it to lose the state across postback? ASPX Page <uc1:StepControl ID=

Compiling/Embedding ASCX templated UserControls for reuse in multiple web applications

倾然丶 夕夏残阳落幕 提交于 2019-12-06 05:11:36
问题 I'm onto a real head scratcher here ... and it appears to be one of the more frustrating topics of ASP.NET. I've got an assembly that implements a-lot of custom Linq stuff, which at it's core has zero web functionality. I have an additional assembly that extends this assembly with web specific behaviour. The web specific behaviour comes with a couple of user controls marked up inside ASCX templated UserControls. I'm having trouble putting a nice finish on this assembly so that it is simple to