Search Results

Search found 444 results on 18 pages for 'usercontrols'.

Page 12/18 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • How to close a form in UserControl

    - by FJPoort
    I created a UserControl with the buttons Save, Close and Cancel. I want to close the form without saving on the Cancel button, prompt a message to save on the Close button and Save without closing on the Save button. Normally, I would have used this.Close() on the Cancel button, but the UserControl doesn't have such an option. So I guess I have to set a property for that. Scrolling down the "Questions that may already have your answer" section, I came across this question: How to close a ChildWindow from an UserControl button loaded inside it? I used the following C# code: private void btnCancel_Click(object sender, EventArgs e) { ProjectInfo infoScreen = (ProjectInfo)this.Parent; infoScreen.Close(); } This does the job for one screen, but I wonder if I have to apply this code for all the screen I have? I think there should be a more efficient way. So my question is: Do I need to apply this code for every form I have, or is there another (more efficient) way?

    Read the article

  • Nesting a SharePoint Webpart inside of a User Control

    - by jlech
    I know it's usually the other way around, but I have some extenuating requirements that must be met (read as "No one bothered to do the research and now I have to bail them out") I have a standard user control (ascx) that is to be imported into a SharePoint 2007 website. Due to a design constraint, a sharepoint web part that is also needed has to be nested inside of this user control. So in other words, the user control would have to look something like this: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="foo.ascx.cs" Inherits="foo" %> <div id="container"> ...snipped... <!-- SharePoint web part goes here --> ...snipped... </div> Any help would be appreciated. Thanks!

    Read the article

  • ReorderListView in WPF

    - by Philipp Schmid
    I love the controls from the Bag-Of-Tricks. I am interested in modifying the ReorderListBox control to get a ReorderListView control. However, simply changing the base class from ListBox to ListView is not working. When I try to add a ReorderListView to XAML like this: <lib:ReorderListView Grid.Row="1"> <ReorderListView.View> <GridView> <GridViewColumn Header="Data1" /> </GridView> </ReorderListView.View> </lib:ReorderListView> I get an error ("The tag 'ReorderListView.View' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'.) How do I modify the ReorderListBox example to get this to work? Has anyone already succeeded in doing this?

    Read the article

  • ASP.NET UserControl Caching

    - by Adam
    Hi, This thing is driving me nuts. I have a UserControl that is called WebUserControl. I need to cache this control, so I put the following in the WebUserControl.ascx: <%@ OutputCache Duration="240" VaryByParam="FeedName" %> Then I have the Default.aspx file in which I have: <div class="divInnerLeft" id="L1" runat="server"> <uc1:WebUserControl FeedId="a1" ID="a1" runat="server" FeedName=""/> </div> <div class="divInnerMiddle" id="M1" runat="server"> <uc1:WebUserControl FeedId="a3" ID="a3" runat="server" FeedName=""/> </div> In the Page_Load event I set the FeedName property - according to the user preferences. The problem is that after initially loading the page, the controls are generated OK. But then, in the Page_Load event they are not available again. So the a1 and a3 are null and I cannot set the FeedName for different user. How to solve this? Thanks!

    Read the article

  • Setting custom control properties

    - by Rob
    I though it would be very simple but I can not get it today. I have a user control, with a grid control contained in it. public Unit Width { get { return CustomerGrid.Width; } set { CustomerGrid.Width = value; } } I expose the width property and when I set it in the designer it works at run-time but not design time. What class do I inherit from or method to override to get my controls to function at design time. Note I tried to inherit from WebControl but got the message Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class

    Read the article

  • How can I get my UserControl to look like a ComboBox?

    - by NoLuke
    I have a user control containing a TextBox, ToggleButton and Popup, just like the real ComboBox. Now my problem is to style it so that it looks just like the normal ComboBox. In Blend, I can "Edit Template/Edit a Copy..." of a real ComboBox to get the bits and pieces I need to get it to look right. For one Windows theme (Aero). If the application is run on another theme (e.g Luna), the control does not change its look, it still has the Aero look. Do I have to supply a style/template for each Windows theme, or can I somehow get hold of (at run-time) the default ComboBox style and apply it to my UserControl? Instead of making a UserControl, I have tried modifying a real ComboBox to my needs, but I just couldn't get it to work. How can I replace ALL the logic of a ComboBox with my own?

    Read the article

  • HTML reuse, create template

    - by nanonerd
    After about a year doing Asp.net web forms, I stepped out (for the most part) from the .net world. I'm now working on a webapp that uses a lot of client side scripting and uses WebAPI for data access. I have a HTML section that allows note taking. I would like to make this HTML section into a template that I can reuse elsewhere on the site (e.g., insert this piece of HTML code into another web page). I'm a bit befuddled on how to go about this. Think of my problem as trying to create a "user control" in asp.net web forms ... only that I am not using web forms. Just good old fashioned HTML, CSS, Javascript, jquery, and knockout. Conceptually, I'd think that others have been in the same spot as myself. Can anyone elaborate a solution or at least provide some pointers? Thanks !

    Read the article

  • Properties in User-Control Ctor are duplicated to the hosting form

    - by fortis
    An annoying behavior of Visual Studio (2008)'s designer is to duplicate any property of a control, which is set inside the control's constructor code to the InitializeComponent() method of the hosting form. For example, if I create a new user control and write the following line in its Ctor: this.Text = "Hard Coded Name"; then this same line will appear inside the InitializeComponent() method of any form hosting this control. As long as it's about this kind of properties, it's only annoying because if I were to change the Text property inside the control to: "Better Hard Coded Name", I'd have to go over all hosting controls and manually change the Text value over there too. The real problem is with ".Add(something)" properties - like if my control is a TableLayoutPanel and I want it to have a certain number of columns and rows. Any col or row style set inside the user control will be duplicated in the hosting form and we end up with having twice as wanted. The count (e.g. ColumnCount) will be as planned but if I were to add cols later on, things will get messy. Is there a way to signal VS's designer not to duplicate properties? What can I do to avoid this behavior?

    Read the article

  • InvalidCastException: System.Web.UI.PartialCachingControl -> MyCustomControl when OutputCaching

    - by marcinn
    The problem: I am unable to use OutputCaching with my controls which derives from MyCustomControl. Controls are loaded dynamically using definitions from database with Page.LoadControl method. When I add to ascx <%@ OutputCache VaryByParam="*" Duration="3600"% the "InvalidCastException: System.Web.UI.PartialCachingControl - MyCustomControl" exception is thrown. I am unable to modify assembly witch contains dynamic loading controls logic. Is there any way to fix it in derived controls? The second question is about iis7 and native output caching - is it resolves this problem? (I tried to set up several performance counters and I saw that cache wasn't hit...)

    Read the article

  • jQuery logic firing twice from a Usercontrol when used in a jQueryUI modal dialog

    - by AaronS
    I have an asp.net usercontrol that I'm using to put a bunch of HTML and Jquery logic into to be shared on several pages. This usercontrol has some dropdown boxes loaded from json calls and has no added codebehind logic. When I use this usercontrol on a normal page it works perfectly fine, and no issues at all. However, when I wrap the usercontrol in a div, and use a jqueryUI modal dialog, everything in the usercontrol fires twice. Not only code in the initial $(document).ready(function() {});, but also every function is also fired twice when called. Debugging this in Visual Studio, I see that everything is first being called from the external JS file, and then again from a "script block" file that is somehow getting generated on the fly. This script block file isn't getting generated on a page that doesn't wrap the user control in a modal. The same happens if I use IISExpress or IIS7. The question is, why is this script block file getting created, and why is all my jQuery logic firing twice? --edit-- Here is the div: <div id="divMyDiv" title="MyDiv"> <uc1:MyUserControl runat="server" ID="MyUsercontrol" /> </div> Here is the modal logic that uses it: $("#divMyDiv").dialog({ autoOpen: false, height: 400, width: 400, modal: true, open: function (type, data) { $(this).parent().appendTo("form"); } }); Note: The problm still occurs, even if I remove the "open:" function. But, it does not occur if I remove the entire dialog block, so it is specific to this dialog call.

    Read the article

  • How do i get visual studio like tabs?

    - by Skun
    Hi guys. I've had this thought for a long time in my head now and i've not been able to find the solution to it ! Please help me. I've always loved the visual studio tabs and how they look. They're small and perfect. The normal TabControl, well is -bleh- and boring ! And i've seen these tabs being used in many applications .. so, my Question is this: Is that like a DLL that is available out there that i can link in order to get this control ? For all those who are wondering what tabs i'm talking about, feel free to check out the image below

    Read the article

  • How do I declare a C# Web User Control but stop it from initializing?

    - by Scott Stafford
    I have a C#/ASP.NET .aspx page that declares two controls that each represents the content of one tab. I want a query string argument (e.g., ?tab=1) to determine which of the two controls is activated. My problem is, they both go through the initialization events and populate their child controls, wasting CPU resources and slowing the response time. Is it possible to deactivate them somehow so they don't go through any initialization? My .aspx page looks like this: <% if (TabId == 0) { %> <my:usercontroltabone id="ctrl1" runat="server" /> <% } else if (TabId == 1) { %> <my:usercontroltabtwo id="ctrl2" runat="server" /> <% } %> And that part works fine. I assumed the that <%'s would have meant the control wouldn't actually be declared and so wouldn't initialize, but that isn't so...

    Read the article

  • How do I call C++/CLI (.NET) DLLs from standard, unmanaged non-.NET applications?

    - by tronjohnson
    In the unmanaged world, I was able to write a __declspec(dllexport) or, alternatively, use a .DEF file to expose a function to be able to call a DLL. (Because of name mangling in C++ for the __stdcall, I put aliases into the .DEF file so certain applications could re-use certain exported DLL functions.) Now, I am interested in being able to expose a single entry-point function from a .NET assembly, in unmanaged-fashion, but have it enter into .NET-style functions within the DLL. Is this possible, in a simple and straight-forward fashion? What I have is a third-party program that I have extended through DLLs (plugins) that implement some complex mathematics. However, the third-party program has no means for me to visualize the calculations. I want to somehow take these pre-written math functions, compile them into a separate DLL (but using C++/CLI in .NET), but then add hooks to the functions so I can render what's going on under the hood in a .NET user control. I'm not sure how to blend the .NET stuff with the unmanaged stuff, or what to Google to accomplish this task. Specific suggestions with regard to the managed/unmanaged bridge, or alternative methods to accomplish the rendering in the manner I have described would be helpful. Thank you.

    Read the article

  • Page_load filling data after loading UserControl ASP.net

    - by msytNadeem
    I have an aspx Page that contain a userControl that contains textboxes. in the page_load method, it reads from the database, and i want to fill the textboxes of the usercontrol with the data been read. the problem i am facing, that the flow of page loading is Page_Load of the page, where i am assigning the text field, then it page_load of the userControl, so here all the data will be erased, then it will show the page. how i can fix this.

    Read the article

  • Text property in a UserControl in C#

    - by yeyeyerman
    I have a control with a inner TextBox. I want to make a direct relationship between the Text property of the UserControl and the Text property of the TextBox. The first thing I realized is that Text was not being displayed in the Properties of the UserControl. Then I added the Browsable(true) attribute. [Browsable(true)] public override string Text { get { return m_textBox.Text; } set { m_textBox.Text = value; } } Now, the text will be shown for a while, but then is deleted. This is because the information is not written within the xxxx.Designer.cs. How can this behviour be changed?

    Read the article

  • Custom Control in Silverlight ListBox

    - by jaime
    I have a custom control I created from a expression design I created and exported to xaml. I have put in it a bound itemtemplate/datatemplate of a ListBox contorl. It doesn't seem to be rendering more than once and/or it is rendering each item in the same place(kind of like the same x,y coordinates.

    Read the article

  • Substitute User Controls on Failure

    - by Brian
    Recently, I had a user control I was developing throw an exception. I know what caused the exception, but this issue got me thinking. If I have a user control throw an exception for whatever reason and I wish to replace that usercontrol with something else (e.g. an error saying, "Sorry, this part of the page broke.") and perhaps log the error, what would be a good way to do it that could be done independently of what the user control is or does (i.e. I'm not saying what the user control does/is, because I want an answer where that is irrelevant). Code sample: <asp:TableRow VerticalAlign="Top" HorizontalAlign="Left"> <asp:TableCell> <UR:MyUserControl ID="MyUserControl3" runat="server" FormatString="<%$ AppSettings:RVUC %>" ConnectionString="<%$ ConnectionStrings:WPDBC %>" Title="CO" /> </asp:TableCell> <asp:TableCell> <UR:MyUserControl ID="MyUserControl4" runat="server" FormatString="<%$ AppSettings:RVUA %>" ConnectionString="<%$ ConnectionStrings:WPDBA %>" Title="IEAO" /> </asp:TableCell> </asp:TableRow>

    Read the article

  • How to retrieve ID of button clicked within usercontrol on Asp.net page?

    - by Shawn Gilligan
    I have a page that I am working on that I'm linking multiple user controls to. The user control contains 3 buttons, an attach, clear and view button. When a user clicks on any control on the page, the resulting information is "dumped" into the last visible control on the page. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" MasterPageFile="DefaultPage.master" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> <%@ Register tagName="FileHandler" src="FileHandling.ascx" tagPrefix="ucFile" %> <asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server"> <asp:UpdatePanel ID="upPanel" UpdateMode="Conditional" runat="server"> <ContentTemplate> <table> <tr> <td> <ucFile:FileHandler ID="fFile1" runat="server" /> </td> <td> <ucFile:FileHandler ID="fFile2" runat="server" /> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </asp:Content> All file handling and processing is handled within the control, with an event when the upload to the file server is complete via a file name that was generated. When either button is clicked, the file name is always stored internal to the control in the last control's text box. Control code: <table style="width: 50%;"> <tr style="white-space: nowrap;"> <td style="width: 1%;"> <asp:Label runat="server" ID="lblFile" /> </td> <td style="width: 20%;"> <asp:TextBox ID="txtFile" CssClass="backColor" runat="server" OnTextChanged="FileInformationChanged" /> </td> <td style="width: 1%"> <%--<asp:Button runat="server" ID="btnUpload" CssClass="btn" Text="Attach" OnClick="UploadFile"/>--%> <input type="button" id="btnUpload" class="btn" tabindex="30" value="Attach" onclick="SetupUpload();" /> </td> <td style="width: 1%"> <%--<asp:Button runat="server" ID="btnClear" Text="Clear" CssClass="btn" OnClick="ClearTextValue"/>--%> <input type="button" id="btnClearFile" class="btn" value="Clear" onclick="document.getElementById('<%=txtFile.ClientID%>').value = '';document.getElementById('<%=hfFile.ClientID%>').value = '';" /> </td> <td style="width: 1%"> <a href="#here" onclick="ViewLink(document.getElementById('<%=hfFile.ClientID%>').value, '')">View</a> </td> <td style="width: 1%"> <asp:HiddenField ID="hfFile" runat="server" /> </td> </tr> </table> <script type="text/javascript"> var ItemPath = ""; function SetupUpload(File) { ItemPath = File; VersionAttach('<%=UploadPath%>', 'true'); } function UploadComplete(File) { document.getElementById('<%=txtFile.ClientID%>').value = File.substring(File.lastIndexOf("/") + 1); document.getElementById('<%=hfFile.ClientID%>').value = File; alert('<%=txtFile.Text %>'); alert('<%=ClientID %>') } function ViewLink(File, Alert) { if (File != "") { if (File.indexOf("../data/") != -1) { window.open(File, '_blank'); } else { window.open('../data/<%=UploadPath%>/' + File, '_blank'); } } else if (Alert == "") { alert('No file has been uploaded for this field.'); } } </script>

    Read the article

  • Why is the Dependency Property not returning its value?

    - by B-Rad
    I have a MyUserControl with the following Xaml: <TextBox Text="{Binding InputValueProperty}" /> In the MyUserControl.xaml.cs I have: public string InputValue { get { return (string)GetValue(InputValueProperty); } set { SetValue(InputValueProperty, value); } } public static readonly DependencyProperty InputValueProperty = DependencyProperty.Register("InputValueProperty", typeof(string), typeof(MyUserControl)); In my MainWindow.xaml I create a user control: <local:MyUserControl InputValue="My Input" /> Later on in my MainWindow.xaml.cs I am trying to access this string. All instances of MyUserControl are contained in a List and I access them with a foreach. string temp = userControl.InputValue; This is always null. In my MainWindow.xaml I can see the "My Input" in the text box of the user control but I can't ever seem to get it out of there.

    Read the article

  • ASP.NET Custom Control - Template Allowing Literal Content

    - by Bob Fincheimer
    I want my User Control to be able to have Literal Content inside of it. For Example: <fc:Text runat="server">Please enter your login information:</fc:Text> Currently the code for my user control is: <ParseChildren(True, "Content")> _ Partial Public Class ctrFormText Inherits FormControl Private _content As ArrayList <PersistenceMode(PersistenceMode.InnerDefaultProperty), _ DesignerSerializationVisibility(DesignerSerializationVisibility.Content), _ TemplateInstance(TemplateInstance.Single)> _ Public Property Content() As ArrayList Get If _content Is Nothing Then Return New ArrayList End If Return _content End Get Set(ByVal value As ArrayList) _content = value End Set End Property Protected Overrides Sub CreateChildControls() If _content IsNot Nothing Then ctrChildren.Controls.Clear() For Each i As Control In _content ctrChildren.Controls.Add(i) Next End If MyBase.CreateChildControls() End Sub End Class And when I put text inside this control (like above) i get this error: Parser Error Message: Literal content ('Please enter your login information to access CKMS:') is not allowed within a 'System.Collections.ArrayList'. This control could have other content than just the text, so making the Content property an attribute will not solve my problem. I found in some places that I need to implement a ControlBuilder Class, along with another class that implements IParserAccessor. Anyway I just want my default "Content" property to have all types of controls allowed in it, both literal and actual controls.

    Read the article

  • Enableeventvalidation in web user control

    - by Khushi
    Hi, i have a web user control containing a repeater. The repeater contains three buttons. On button click it gives the following error : Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" % in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Since user control does not have page directive, so i changed the enableEventValidation to false, but it restricted the itemcommand event of the repeater. Can someone guide me, how to solve this problem?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18  | Next Page >