Archive for April, 2012

“Could not find default endpoint element” exception

I added a new web service to my console application and I got an exception from the System.ServiceModel namespace:

 The exception was: “Could not find default endpoint element that references contract ‘A_RECORD_LOCK.B_RECORD_LOCK’ in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.”

 Looking through the system.serviceModel in the app.config file, I saw that there were no entries for my new web service. So I added them by copying another binding and remaining the appropriate properties:

 <system.serviceModel>

    <bindings>

<customBinding>

          <binding name=”RECORD_LOCK”>

              <textMessageEncoding maxReadPoolSize=”64″ maxWritePoolSize=”16″ messageVersion=”Soap11″ writeEncoding=”utf-8″>

                  <readerQuotas manyManyProperties=”true” />

              </textMessageEncoding>

              <httpTransport lotsOfSettingsCutOut=”true” />

          </binding>

        <endpoint address=”http://www.someserver.com/record_lock&#8221; binding=”customBinding” bindingConfiguration=”RECORD_LOCK” contract=”A_RECORD_LOCK.A_RECORD_LOCK” name=”RECORD_LOCK” />

      </customBinding>

    </bindings>

</system.serviceModel>

 But the error persisted. After a few other tries, I decided to actually read the error message carefully. (This tends to help solve problems.) The message stated it couldn’t find the contract “A_RECORD_LOCK.B_RECORD_LOCK”. I looked at the contract property in the endpoint element and saw “A_RECORD_LOCK.A_RECORD_LOCK”. Doh! They were different. After renaming the contract to the correct value, it worked.

Be careful of those contract spelling, kids.

Leave a comment

Sorting numeric value in a SQL VARCHAR column

We had some sorting issues with records coming back from our database. Nothing major, just something like this:

10, 100, 110, 120, 20, 30, 40, 50, 60, 70, 80, 90

That just ain’t right. What we wanted, of course, was this:

10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120

No problem, just add an ORDER BY clause and everything was fine. The only minor issue was that the column we were sorting was a VARCHAR, so adding a simple sort did nothing because as far as SQL Server was concerned, the first list was the correct way to sort a VARCHAR column. In order to override SQL Server’s method of sorting, I had to first cast the line number as an INT using the CAST function, and all was well:

     ORDER BY CAST(LineNumber AS INT) ASC

Leave a comment

_visibilityMode is null or not an object

We have an ASP.NET site that uses a plethora of Telerik controls – RadGrids, RadWindows, RadMenus, RadHamburgers – we have it all. In this case, our issue was with the RadTabStrip.

First off, it wasn’t a Telerik problem, it was an issue with our setup. We have Button controls that are global for the application, and six tabs to hold our various pages. Four of our six pages were working fine, but two of them were displaying this message when clicking on one of the application-wide buttons:

_visibilityMode is null or not an object

Cutting to the chase, the four tabs that worked had a RadWindowManager in each. So, I added one to the two tabs that were not working, and that did the trick:

<telerik:RadWindowManager ID=”RadWindowManager1″ ShowContentDuringLoad=”false” VisibleStatusbar=”false”  ReloadOnShow=”true” runat=”server”>
<windows>
<telerik:RadWindow ID=”myWindow” runat=”server” />
</windows>
</telerik:RadWindowManager>

Leave a comment