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

Post New Web Links

How can I bind a ConverterParameter value ?

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :WPF
I would like to make a textblock display the remaining time of an operation. The bound object has two properties:  ElapsedTime and TotalDuration, both of type TimeSpan.I thought the following should work, but it doesn't because the parameter passed to my custom converter is a Binding object, instead of the result of the binding:<TextBlock      Text="{Binding ElapsedTime,         Mode=OneWay,         ConverterParameter={Binding TotalDuration},         Converter={StaticResource RemainingTimeConverter}}" />The RemainingTimeConverter is implemented to subtract the "value" from the "parameter" and return a string representation of the resultant TimeSpan value.Why isn't the inner Binding evaluated and its value passed to the outter binding ConverterParameter ?   Is this by design ?   If that's the case what's the use of having ConverterParameter if I can only use harcoded values ?

View Complete Post

More Related Resource Links

How to bind GridView and DropDownList controls using DataTable object

In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.

How to bind TemplateField DropDownList with ArrayList?


Hi Expert!

  I'm trying gridview templateField DropDownList bind with arraylist. When i set bindsource i got this error. "//Error Object reference not set to an instance of an object."

My Sample .aspx

<asp:TemplateField HeaderText="Type">
                        <asp:DropDownList ID="_grvcboType" runat="server" Width="117px" DataTextField="Display" DataValueField="Value">
                        <asp:Label ID="Label7" runat="ser

how to bind Dropdownlist based on textbox values



I have one drodownlist which show data based om textbox values...

Let us consider i have 

Select Name from table1 where Type IN(@typ)

here @typ is textbox values

here for example textbox will have some thing like this L1,L2,L3..

How to filter Name based and shown in drodownlist based on this L1,L2,L3(on textbox)..

Help me in this

.NET Reflection: Dynamically Bind Your Data Layer to Stored Procedures and SQL Commands Using .NET M


One major inconvenience of using SQL stored procedures from code is having to match type information. You have to write long wrapper functions around the procedures just to expose the data types. In the .NET Framework, however, the reflection services of the System.Reflection namespace allow you to query rich metadata that describe data types. This article explains how to use reflection in .NET to end your stored procedure nightmares. The author creates four custom classes, including one that generates a SQLCommand object based on the metadata of a method. Using this library, you'll be on your way to automating the generation of stored procedures.

Atif Aziz

MSDN Magazine August 2002

Change data on gridview bind


Hi there,

Simple little problem. i have a gridview that shows products assigned to a customers job. They are displayed in exVAT prices. To make it easier i want to show the inc VAT prices. How can i add VAT to 1 column in this table?

Access and Bind data wihtout using Datasource Control


i want to bind my gridview with a dataset with concept of caching (to minimize the database server trips). plz give me a best example to get and bind data to gridview (command line) . grid paging is also enabled so example code should be capable to rebind data at Gridview page change.  

listview 3.5 bind dropdownlists edit item template VB.NET


I am trying to do this with many issues of data binding doubling the amount and not setting selectedValue on dropdownlist. I have read some posts and they help but I am missing a crucial piece. My problem is that my dropdownlist is doubling the amount of records for the dropdownlist. Instead of "YES;NO;SELECT A VALUE", I am getting "YES;NO;SELECT A VALUE;YES;NO;YES;NO". My database is correct with the UPDATE part but the rebind after update is failing horribly.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then
            If Session("ACTIVETAB").ToString() = Session("SUBCONTRACTSATABNO").ToString() Then
            End If
        End If
    End Sub

    Public Function loadlookups(ByVal id As String, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) As DataTable
        Select Case id
            Case "ddlCertReceived"
                dt = GetLookupTable("SubcontractsA", "Sub 1 Cert Received")
                Dim ddlCertReceived As DropDownList = _
                CType(e.Item.FindControl("ddlCertReceived"), DropDownList)
                ddlCertReceived.DataSource = dt
                ddlCertReceived.DataTextField = "lup_text"

bind values to dropdownlist using ASP.NET MVC



I'm using asp.net MVC 2.0, my controller coding is,

foreach(DataColumn dc in dtImport.Columns)


TempData["drpsku"] = dc.ColumnName.ToString();


i need to bind this value to the drpdown list in the aspx page.

<asp:DropDownList ID="DropDownList1" runat="server"></asp

Formview + EditItemTemplate + Bind + PageLoad + Prerender = Confused


I am working with a formview edititemtemplate.  Currently in my page load, i have some stuff that would show or hide certain panels based on dropdownlist values.  These dropdown values get binded during page load.  I need to be able to change the values/dropdowns, without rebinding the old data, and updating the visibility of the panels based on predefined rules.

I have experimented with putting my formview.databind() in page load if isnotpostback, in prerender, in prerender if isnotpostback.   I have tried my rules (ex if ddlState.selectedvalue = "DE" then pnlDelaware.visible = "true") in the page load, and the page render.   I'm just not sure how to get the stars aligned here.

The closest i have come is having the databind in the pageload if notispostback, and the rules in the prerender.   However I get an error "dropdownlist has a SelectedValue which is invalid because it does not exist in the list of items.


Infopath form using Visual Studio - How to bind repeating table on submit button click ?


Hello friends,

   I have created infopath form using Visual Studio 2008

Form have 3 dropdowns and one repeating table which is bound by Datasource ( List from sharepoint ).

whenever i select appropritae values from drop down, Repeating table gets bound as datasource for dropdown and repeating table are same.

I have done conditional formating for repeating table using repeating table properties.


My Question:


Now i included one submit button and i want when i click submit button it will check DropDown Values and if appropriate record matching these values found it will fill repeating table

How i achive this ? as i dont find how to bind repeating table on submit button.

Please help if anyone have answer.


Thanks and Regards,


Kapil Bhosale.




How to bind to DisplayMemberPath in a customercontrol that derived from ComboBox?

Hello, All: I need a customer control which derives from ComboBox. In its resource file I have the style:   <Style TargetType="{x:Type local:MyComboBox}">             <Setter Property="SnapsToDevicePixels" Value="True"></Setter>             <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>             <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>             <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>         <Setter Property="ItemTemplate">                 <Setter.Value>                     <HierarchicalDataTemplate>                     <CheckBox Content="{Binding Path=DisplayMemberPath,Mode=TwoWay,RelativeSource={RelativeSource

How to bind a WCF Http client to a specific outbound IPAddress before making the request

I want my request to go out through a specific IP Addresses. Is there a way to do that in WCF. The explanation of why I need this is a little long winded so i'd rather not get into that. Here is sample code string ipAddress = ""; IService service; ChannelFactory<IOmlService> factory = new ChannelFactory<IService>(new BasicHttpBinding(), new EndpointAddress("http://" + IPAddress + ":6996/IService")); service = factory.CreateChannel(); service.Test(); Here is an example scenario to explain exactly what i'm looking for. Let's say I have two IPs on my machine ( and Both of them can hit If i run this code now, it will hit the IP (.32) from any of my IPs (.30 or .31). How can i force it to go through a specific IP of mine (say .30). Is there any way to do that using WCF? Thanks

bind drop down list in content page from value from master page

Hi all, I have applied nested master page to some page. Now i want to bind drop downlist from value selected in dropdown list in master page of master applied to that page. the hierarchy of pages is  mypage.aspx -> main.aspx -> inner.master I want bind dropdown list in  mypage.aspx from  from value selected in dropdown list in  inner.master Please help me. 

How can I bind 2 comboboxes in 2 different WPF windows to the same observable collection?

I have a pretty simple (or deceptively not so) question. I have a WPF application that has a nicely bound combo to an ObservableCollection. I am trying to correctly implement MVVM. One thing I am trying to do (as a test for other things I need) is to have a combo in a popup window have the same content (2-way data bound) as the combo on the main window. I have the main window set up with no issues. <     ComboBox Height="23" HorizontalAlignment="Left" Margin="110,197,0,0" Name="comboBox1" VerticalAlignment="Top" Width="194" ItemsSource="{Binding MyStuff}"/> where "MyStuff" is an ObservableCollection. My problem comes when I create a new wpf application (separate project), put a combo on it, launch it from a button in the first project, and try to bind the combo to the same ItemsSource. I can't seem to figure out the syntax. My 2 issues are as follows: 1. I think the XMAL in the child window needs to have something like this: <     ComboBox Height="23" HorizontalAlignment="Left" Margin="110,257,0,0" Name="comboBox1" VerticalAlignment="Top" Width="194" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ObservableCollection}, AncestorLevel=2}

Can't bind a UDP socket to a port

using System; using System.Net; using System.Net.Sockets; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int port = 11000; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPEndPoint ipendpoint = new IPEndPoint(IPAddress.Any, port); try { socket.Bind(ipendpoint); Console.WriteLine("Successfully bound to port " + port); } catch (SocketException e) { Console.WriteLine("Winsock error: " + e.ErrorCode.ToString() + ", " + e.Message.ToString()); } Console.Read(); } } } I get the error code [b]10022[/b] when trying to bind the UDP socket, which is "Invalid argument specified". This is the same for all the UDP server examples on the internet at the binding stage, as well as the MSDN one. It will work if the port is 0, but not if the port is anything but 0. TCP binding works fine, and I can make a UDP server on any port with Java (the binding works fine) but in C# it gives me this error. The code works for everyone I've asked to try it, and I've got the latest NET framework (version 4) and Windows XP with SP3 so I know the commands are supported by the OS (also, Visual C# 2010 Express and 2008 Express both give this error). Any ideas to fix it?

#BIND two seperate data items into one label

Hey people!I have a simple question.. but for the life of me cannot figure it out. I have two fields in my database (firstname and lastname)I have a formview, and I filter the results and I get two labels - one with firstname and one with lastname. I want to put the FIRSTNAME and LASTNAME together in one label but I am stuck lol. <asp:label id="label1" runat="server" SkinID="profilepropertylabel" Text='<%BIND ("Firstname") & BIND("Lastname") %>' />It only gives me the last name when I do that. Help?

How to bind a calendar control to a datasource

In my application, user will enter some meeting dates in one page.   In the details page, they need to see those dates to make a selection for one file number. I want to show a calendar in the details page whice will show the dates already entered. To do that I need to bind the calendar to a datasource to get the information from the database. Please guide me to do that. Thanks in advance,
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