Watch this example on Youtube:
Add Update Progress, Modal Popup Extender and Panel with image and label
whole code looks like:
<div class="ControlsCenter">
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:ModalPopupExtender ID="modalExtender" runat="server" TargetControlID="UpdateProgress1"
PopupControlID="Panel1" DropShadow="true" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="modalExtender">
<img alt="Processing" src="../Images/working.gif" />
<br />
<asp:Label ID="lblProcessing" runat="server" Text="Processing..." CssClass="TitleBar"></asp:Label>
</asp:Panel>
</div>
Modal is executed when Update Progress is called and displays controls from Panel therefore:
TargetControlID="UpdateProgress1"
PopupControlID="Panel1"
class="ControlsCenter" will center all controls
.ControlsCenter
{
margin-left: auto;
margin-right: auto;
width: 50em;
text-align:center;
}
BackgroundCssClass="modalBackground" will shadow whole screen
.modalBackground
{
background-color: Gray;
filter: alpha(opacity=50);
opacity: 0.50;
}
CssClass="modalExtender" will just centralize all controls inside
.modalExtender
{
border-width: 1px;
border-style: solid;
background-color: #FFFFFF;
position: absolute;
text-align:center;
}
add the following javascript code just after form tag
</form>
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(showPopup);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(hidePopup);
function showPopup(sender, args){
var ModalControl ='<%= modalExtender.ClientID %>';
$find(ModalControl).show();
}
function hidePopup(sender, args) {
var ModalControl ='<%= modalExtender.ClientID %>';
$find(ModalControl).hide();
}
</script>
Thursday, October 20, 2011
ASP.NET - Add paging
set AllowPaging="True"
and implement the following procedure
Private Sub gvReport_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvReport.PageIndexChanging
gvReport.PageIndex = e.NewPageIndex
gvReport.DataSource = ds.Tables("TableName").DefaultView
gvReport.DataBind()
End Sub
and implement the following procedure
Private Sub gvReport_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvReport.PageIndexChanging
gvReport.PageIndex = e.NewPageIndex
gvReport.DataSource = ds.Tables("TableName").DefaultView
gvReport.DataBind()
End Sub
ASP.NET - GridView - Add scrollbar and freeze header
To add scrollbar and freeze header of gridview
modify DocType <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
put your grid inside <div id="Div1" style="OVERFLOW: auto; HEIGHT: 700px">
<div id="Div1" style="OVERFLOW: auto; HEIGHT: 700px">
<asp:GridView ID="gvReport" runat="server" AllowPaging="True" CssClass="dataGrid">
modify DocType <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
put your grid inside <div id="Div1" style="OVERFLOW: auto; HEIGHT: 700px">
<div id="Div1" style="OVERFLOW: auto; HEIGHT: 700px">
<asp:GridView ID="gvReport" runat="server" AllowPaging="True" CssClass="dataGrid">
Tuesday, October 18, 2011
CSS - different align issues - align divs and controls inside div
div will start from the right, controls inside it will start from the left
<div style="float: right;">
div will start from the right, controls inside it will start from the right
<div style="float: right; text-align:right;">
Friday, October 7, 2011
MS SQL - Convert Date to Month Name and sort
Convert date to month:
DATENAME(month, TableName.DateFieldName) AS [Month Name]
Full statement with sorting by month:
SELECT DATENAME(month, TableName.DateFieldName) AS [Month Name]
FROM TableName
ORDER BY MONTH(TableName.DateFieldName)
DATENAME(month, TableName.DateFieldName) AS [Month Name]
Full statement with sorting by month:
SELECT DATENAME(month, TableName.DateFieldName) AS [Month Name]
FROM TableName
ORDER BY MONTH(TableName.DateFieldName)
Thursday, October 6, 2011
C# - .NET - Wrong Date Format
Culture settings in visual studio for same reasons are not the same as in regional settings.
In regional settings it is set to en-US and while executing the following code while running the page CultureInfo.CurrentCulture
I am getting en-CA
Not sure why this is happening - couldn't find anything online, but a way around was to modify web.config
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US"/>
Not sure why this is happening - couldn't find anything online, but a way around was to modify web.config
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US"/>
Subscribe to:
Posts (Atom)