Friday, October 19, 2012

Custome format of DateTime in WPF Data Grid


If we want to show only date and skip the time part
 
<DataGridTextColumn Header="Entry Date" Width="*" Binding="{Binding Path=DATE,StringFormat=\{0:dd.MM.yyyy \}}" >
</DataGridTextColumn >

Result is e.g. 19.10.2012

<DataGridTextColumn Header="Entry Date" Width="*" Binding="{Binding Path=DATE,StringFormat=\{0:dd.MM.yy \}}" >
</DataGridTextColumn >

Result is e.g. 19.10.12

<DataGridTextColumn Header="Entry Date" Width="*" Binding="{Binding Path=DATE,StringFormat=\{0:dd.MM.yy \}}" >
</DataGridTextColumn >

Result is e.g. 10.19.12



OR we can show only time without Date like
 

<DataGridTextColumn Header="Entry Date" Width="*" Binding="{Binding Path=DATE,StringFormat=\{0:HH.mm.ss \}}" >
</DataGridTextColumn >

Result will be like  22:19:33


Tuesday, October 9, 2012

Pass More Evals in QueryString with String.Formate



<asp:TemplateField HeaderText="EMail" SortExpression="EMail">
    <ItemTemplate> 
         <asp:HyperLink ID="hp" runat="server" 
                  CommandArgument='<%# Eval("SysID", "{0}") %>' 
       NavigateUrl='<%#  String.Format("~/ReportViewer.aspx?RevID= {0} 
      & User={1}", Eval("ID"),  Eval("USER")) %>' Target="_blank"  %>'>
</asp:HyperLink>
     </ItemTemplate>
</asp:TemplateField>




Wednesday, September 5, 2012

mailto: from HyperLink to allow the user to send emails

Hyperlink Control for mailto: to be used like this anywhere in the page
 
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("EMail") %>'
     NavigateUrl='<%# Eval("EMail", "mailto:{0}") %>'></asp:HyperLink>
 
HyperLinks in the GridView Row link use as Mailto:

 
<asp:TemplateField HeaderText="EMail" SortExpression="EMail">
    <ItemTemplate> 
         <asp:HyperLink ID="HyperLink1" runat="server" 
            NavigateUrl='<%# Eval("EMail", "mailto:{0}") %>' 
            Text='<%# Eval("EMail") %>'></asp:HyperLink>
     </ItemTemplate>
</asp:TemplateField>

Tuesday, July 17, 2012

Window.open from NavigateUrl Property

Window.open in Navigate Url from code behind

Make JavaScript function in HTML

function ShowPopup(url, name, width, height) {
            window.open(url, name, 'width=' + width + ',height=' + height + ',menubar=no,status=no,statusbar=no,scrollbars=1,top=150,left=400');
        }
 
C# code behind call that function 

url = "Popup.aspx?DetID" + det.ID.ToString();
nodeDet.NavigateUrl = "javascript:ShowPopup('" + url + "','Popup'," + 800 + "," + 600 + ");";

Where url is the NavigateUrl
Popup is the name of the popup
height and width is height and width of the popup.

Hyperlink Navigate Url to window.open


<asp:HyperLink ID="HyperLink1" runat="server"
      
 NavigateUrl
="javascript:window.open('http://www.google.com','Popup','statusbar=0,toolbar=0')">
asp:HyperLink>


Response.Redirect to new window


Always get the response in new window by adding an attribute target="_blank" in form tag.
When page will do post back it will automatically open response in new window
 


html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
xmlns="http://www.w3.org/1999/xhtml">
   runat="server">
        <title>title>
    head> 
    <body> 
<form id="form1" target="_blank" runat="server">

<asp:Button ID="Button1" runat="server" Text="Button" />
form>

     body>
html>

Monday, May 21, 2012

Remote desktop full screen mode short cut key

Remote desktop full screen mode short cut key is Ctrl + Alt + Pause/Break you can also change it from options here are the steps

Start "Remote Desktop Connection".
-Click on "Options".
-Click on the "Display" tab.
-On "Display configuration" settings,  change the "Remote Desktop Connection" display with slider from "Small to Large".
-By moving the "Slider" all the way to large, the display settings will automatically set to "Full Screen".

Sunday, March 18, 2012

How to refresh XSD file when change in query

Selecting "Configure" in the dataset designer.
Then in the TableAdapter configuration wizard, in select query it'll show changed columns added or deleted.
After clicking "Finish", the data tables are re-generated and refreshed.

I've checked it in VS2010.

How to refresh Tablix dataset in rdlc report

Just follow these steps
  1. Open the report
  2. Click menu item 'View', then 'Report Data'
  3. Right click the report dataset, then select 'Refresh'
you can find more details here.