.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Is it Possible to Reuse a Trigger on Multiple Controls Easily?

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :WPF
I have a simple trigger that is generic such that I would like to reuse it on 15 different labels. Can I define it in one place somehow and just assing it to each of the labels rather than just pasting the same code into the style for each label?

View Complete Post

More Related Resource Links

Not getting multiple composite controls on master page


I have created two composite controls in the same assembly and registered that assembly in a master page using <%@ Register tag.

When I try to use these controls using the registered tag prefix I am getting only one control along with the tagprefix .

How to get all the composite controls present in the registered assembly?

How to I apply an XAML declared animation to multiple controls dynamically?

Hello, How to I apply an XAML declared animation to multiple controls dynamically? Here is the XAML declared animation: <Window.Resources> <Storyboard x:Key="TextBlock_SB"> <DoubleAnimation Storyboard.TargetName="TextBlock_1" Storyboard.TargetProperty="(TextBlock.Opacity)" From="1.0" To="0.75" Duration="0:0:0.5" AutoReverse="True" RepeatBehavior="Forever" /> </Storyboard> Here is the code that starts the animation for TextBlock_1: (this.Resources["TextBlock_SB"] as Storyboard).Begin(); I want to apply the same storyboard/animation to TextBlock_2 and TextBlock_3 and perhaps others.  How do I do that without defining more XAML storyboards? Regards, Robert  

Ajax Accordion - Multiple controls with the same ID '_content' were found

Hi I'm dynamically adding accordion panes to an Accordion Control. When I add a single pane, no problem but trying to add 2nd pane I get the exception: *Multiple controls with the same ID '_content' were found* I've tried assigning unique Ids to the panes as follows but not joy. Can anyone please help? Thanks Rob.    if (User.IsInRole(@"arcpet\RDLM - Tradecapture Initial Margin Users - Security")) {      //build header for pane      AccordionPane pneTCaptureInitalMargin = new AccordionPane();      pneTCaptureInitalMargin.HeaderContainer.Controls.Add(new LiteralControl("(TCIM)T/Capture Initial Margin"));      pneTCaptureInitalMargin.ID = "AccordionPane" + Guid.NewGuid().ToString();      pneTCaptureInitalMargin.HeaderContainer.ID = "HeaderContainer" + Guid.NewGuid().ToString();      //build content for pane      pneTCaptureInitalMargin = AddHyperLink("Trade Books &amp; Markers", "TradeBook/TradeBook.aspx?4", pneTCaptureInitalMargin);      acc.Panes.Add(pneTCaptureInitalMargin);           pneTCaptureInitalMargin = AddHyperLink("+Create New Records", "TradeBook/TradeBookDetail.aspx?acPane=4&type=new", pneTCaptureInit

Select multiple controls on tabpage, Drag & Drop control(s) (WinForms)


I'm wondering, if somebody got some code or thoughts for selecting multiple control displayed on tab page and drag & drop control on tab page it self. Something like on windows desktop, where you can draw a rectangel with mouse cursor to select folder and files. Also, drag folder or files to different location.



Multiple issues with dropdown list controls not working correctly


I am using WSS 3.0 and SharePoint Designer.  I have modified one of the items in my NewForm page so that I have a filtered lookup using a spdatasource. The filter works great, but my issue is that I can't seem to save the users selection back to the list itself.

Issue when using an ASP.NET dropdown list
I am able to bind the filtered spdatasource to an ASP.NET dropdown list control, however the item that is selected in the dropdown list is not being saved back to the list.  I am guessing that this is because the dropdown list itself is not tied directly to the appropriate list item, but... I can't seem to figure out how or where to do this.  I don't see anything in the data properties box in SharePoint Designer that allows me to tie the data back to the list itself.  Maybe I am just overlooking it somewhere?

Issue when using the native SharePoint Data View DropDownList with a filtered spdatasource
When I select "Data Fields..." on the dropdown control I get the Change Data Bindings dialog box.  From here I can select a data field to save the value back to (which resolves the issue noted for the asp.net control) and I can select my spdatasource, but... the display text and value fields below that never populate.  Thus, the dropdown list is empty when the user is filling ou

DataAnnotation on multiple user controls displaying on wrong control


I have a table that displays a user control on each row. The user controls are strongly typed to a viewmodel which contains DataAnnotation style validation. If one of the rows has invalid data entered (lets say the 3rd row) the data annotation validates display agains the first row/user control.

How do I get the data annotation to show against the relevant user control?

I'd post a pic to show what I mean except it will not display it!.:/

Having multiple UpdateProgress controls working


I have an application that is using TabContainers and TabPanels. Within each TabPanel I have a DropDownList and a GridView. The GridView is filled on "SelectedIndexChanged" event.

I have managed to get UpdatePanel and UpdateProgress working for one on the instances but I do not seem to have luck implementing additional UpdateProgress controls for the rest on the application.

I have tried to use "AssociatedUpdatePanelId" but read that external trigger will not work. I've also tried to assign each UpdateProgress value of UpdatePanel in code behind (

UpdateProgress1.AssociatedUpdatePanelID = UpdatePanel1.UniqueID)

 , not working for me either:

I have created a Java SCript that hides GridView when UpdateProgress is being shown (works fine too)

This is what I have (and working):



<script type="text/javascript">
      window.onload = function() {
          var prm = Sys.WebForms.PageRequestManager.getInstance();
          if (prm != null) {
              prm.add_beginRequest(function(sender, e) {
                  var gridView = document.getElementById("<%=GridView2.ClientID %>");
                  if (gridVi

Getting values from Multiple user controls



I have a asp.net page where i had placed two user controls.When the asp.net page loads naturally the first user control loads and then then the second user control loads.There is a value in the page load event of the first user control.I need to get this value in the second user controls page load event.

Can someone help me with this problem.

Thanks and Regards


How to show all ValidatorCalloutExtender multiple controls



I am trying to implement ValidatorCalloutExtender to the RequiredValidator controls.

I can say it is working, but i cannot find a way to show all ValidatorCalloutExtender at the same time.

When I click submit button, all RequiredValidator controls are fired but only first ValidatorCalloutExtender control is visible. To activate the others, user needs to click other controls, then related ValidatorCalloutExtender controls pupup.

How to show all ValidatorCalloutExtender multiple controls?


Make validation controls trigger only not clicking on submit button and not on other navigational bu


I have required validation controls on a page.  If the user got to this page by mistake and wants to go to a different section of the website using the navigational buttons; required validators are triggered and it will not let the user navigate away.  How do I get validators to trigger only when a submit button is clicked?


Thanks in advance!

Auto udating data in multiple table through trigger.


table a(

sno IDENTITY int(1),

name varchar(5),

roll_no numeric(5)

sum more columns


table b(

sno IDENTITY int(1),

name varchar(5),

sum more columns


table c(

sno IDENTITY int(1),

roll_no numeric(5)



Could any one kindly tell me how can i do it.

whenever data is entered in table a the values of name and roll_no to be automatically filled in table b and table c with use of trigger.

Update Trigger For Multiple Rows



I've written a trigger that fires on a table after an insert and SHOULD update the destination table if a record exists or performs an insert if the record doesn't exist. I'm having trouble because in some instances it won't run because the subquery is returning multiple rows from the INSERTED table. Code is below. Any help is greatly appreciated.


CREATE TRIGGER [dbo].[InsertOverflowHistory_Trigger]
  ON [dbo].[ContainerDetail]

  DECLARE @Store       NCHAR(5);
  DECLARE @ItemWeight    DECIMAL(12,4);
  DECLARE @ItemCube     D

AutoPostBack issue with other web controls resulting in multiple clicks on "Save" Button


A new ASP.NET web application that I've been working on has among other web controls on the DetailView, a DropDownList for Category (ddlCategory) a TextBox for Quantity (txtQuantity) a Label for the Rate (lblRate) and a Label for the Amount (lblAmount) along with a Save button (btnSave), etc.; there are also TabIndexes set to progressively navigate from control-to-control ending on the Save button.  NOTE: the user would like to see the Rate & Amount values in the DetailView prior to saving the record.

The Rate is determined by the selected the Category so I have the AutoPostBack property set to "true" on ddlCategory to make a call to the database to retrieve the Rate on the SelectedIndexChanged event; likewise, the AutoPostBack property on txtQuantity is set to "true" in order to compute the Amount (and populate lblAmount) once the user enters a Quantity.  Theoretically, the user could enter the values sequentially and still go back to change the Category prior to the save so simply performing some client-side JavaScript to compute the Amount would not be bulletproof.

Everything works according to plan when the user tabs from control-to-control {e.g., Category > Quantity > Save}, or tabs off the control.  However, the problem occurs when the user enters all the values and then clicks on the Save button without tabbing off the

Problem with having multiple user controls in 1 app


I have some problems with User Controls when they are used in conjunction with TabControl bound to a ICollectionView (from a ObservableCollection<TabViewModel>). The UserControls all seem to act as 1 and content I enter in 1 will also appear in other UserControls.

Suppose I have TabViewModel, a simple class with properties for Tab Title and Content

public class TabViewModel : ObservableObject
  protected string _tabTitle;
  protected string _text; 

  public string TabTitle {
    get { return _tabTitle; }
      _tabTitle = value;
  public string Text {
    get { return _text; }
      _text = value;

Use multiple AdRotator controls on one page - no duplicates


Is there a way to use two adrotators controls on one page and stop the same advert appearing at the same time in both controls?

I have the following but it doesn't work:

protected void AdRotator1_DataBound(object sender, EventArgs e)
        if (AdRotator1 == AdRotator)


Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend