Thursday, July 7, 2011

TargetInvocationException was unhandled by user code - Solution

I had been working with an Asp.Net Dynamic Data Web Application, I got an error while debugging the application.

TargetInvocationException was unhandled by user code : Exception has been thrown by the target of an invocation.



This error was because of the wrong filename in the entity connection string. I have fixed this and got it working.

If connection string is not exist in web.config, we will get the same error while debugging.

Note : always check the inner exception details when you are facing this error. This will help you to track out the actual exception caused the error.

Monday, July 4, 2011

Customizing QueryableFilterRepeater Control - Aligning controls

Hi all, Here is a simple solution for customizing the QueryableFilterRepeater control. By default this control adds the filter controls without any alignment, so we should do it manually.
                <table>
<tr>
<td style="width:100%;">
<asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
<ItemTemplate>
<div class="SearchColumn">
<asp:Label runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" />
<asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" />
</div>
</ItemTemplate>
</asp:QueryableFilterRepeater>
</td>
</tr>
</table>

here is the css class used.
div.SearchColumn
{
float:left;
width:48%;
margin:2px 2px 2px 2px;
}