Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
614 views
Hi,

I have a login page, in which if the user enters an username which has been already been used by somebody else to login in the application, then i want to show a confirmation message. The confirmation message has to be shown only if the user provides a valid credentials and that username is already been used for another session.
I have already written down the code for this in the code behind, but I am unable to show a confirmation box at page load. I have tried with the Page.ClientScript.RegisterClientScriptBlock() and Page.ClientScript.RegisterStartupScript() but its not working. This is my aspx page's code :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="ERPx.Web.Login" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title>BluWare</title>
    <style type="text/css">
        *
        {
            margin: 0;
            padding: 0;
        }
        body
        {
            font-family: Calibri, Verdana, Helvetica, sans-serif;
            background: url(images/login-page-bg.jpg) top center no-repeat #c4c4c4;
            color: #3a3a3a;
        }
        .clear
        {
            clear: both;
        }
        form
        {
            width: 406px;
            margin: 170px auto 0;
        }
        fieldset
        {
            border: 0;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="CheckBoxes, RadioButtons, Buttons, Textbox, Textarea, Fieldset, Label, Select, Zone, GridFormDetailsViews" />
    <telerik:RadWindowManager ID="rwmMain" runat="server" />
    <div>
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="100%">
            <asp:Panel ID="pnlLogin" runat="server" DefaultButton="btnLogin">
                <asp:Image runat="server" ID="CompanyLogo" ImageUrl="~/Images/GenericLogo.png" Height="55px"
                    Style="position: absolute; top: 25px" />
                <table width="406px" cellspacing="10px">
                    <tr>
                        <td>
                            Email Address
                        </td>
                        <td>
                            <telerik:RadTextBox ID="txtEmailAddress" runat="server" Width="260px" MaxLength="50" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Password
                        </td>
                        <td>
                            <telerik:RadTextBox ID="txtPassword" TextMode="Password" runat="server" Width="260px"
                                MaxLength="50" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                              
                        </td>
                        <td>
                            <asp:CheckBox ID="chkRememberMe" Text="Remember Me?" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a href="RequestLogin.aspx">Request Login</a>
                        </td>
                        <td align="right">
                            <asp:Button ID="btnLogin" runat="server" Text="Login  " Width="75px" OnClick="btnLogin_Click" />
                        </td>
                    </tr>
                    <tr align="center">
                        <td colspan="2">
                            <asp:Label ID="lblError" ForeColor="Red" runat="server" Text="Invalid login. Please try again."
                                Visible="false" />
                        </td>
                    </tr>
                </table>
                <br />
                <br />
                <br />
                BluWare  <asp:Label ID="lblSoftwareVersion" runat="server" />
            </asp:Panel>
        </telerik:RadAjaxPanel>
    </div>
    </form>
</body>
</html>

protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Session.Abandon();
            FormsAuthentication.SignOut();
  
            if (IsPostBack)
            {
                if (!(String.IsNullOrEmpty(txtPassword.Text.Trim())))
                {
                    txtPassword.Attributes["value"] = txtPassword.Text;
                }
            }
        }
  
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Users usr = new Users();
            DataTable dt = usr.ValidateUser(txtEmailAddress.Text, Encryptor.Encrypt(txtPassword.Text));
  
            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                if (!bool.Parse(dr["UserSessionExists"].ToString()))
                {
                }
                else
                {
                 // Over here I am registering the starup script
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "LoginError", "confirm('Ovverride ?');", true);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "LoginError", "confirm('Ovverride ?');");              
                }
            }
            else
            {
                ErrorMessage = "Invalid login information supplied.";
            }
        }


But the confirmation box is not showing. Please help me out !
Bibhudutta
Top achievements
Rank 1
 answered on 11 Apr 2013
1 answer
81 views
Hi All,

How can I modify the Radwindow width and height in JS?

Thankyou,
Saravanan
Princy
Top achievements
Rank 2
 answered on 11 Apr 2013
1 answer
287 views
Hi,

I have a Htmlchart with 200 columns displayed as a BarSeries. The bar series is displayed with some pattern, where it is showing up with a lighter color for some columns at regular intervals( like a pattern).

I need to show all the columns in the same color without any difference in the color of the series for all columns.



Danail Vasilev
Telerik team
 answered on 11 Apr 2013
2 answers
110 views
Hi,

I have a radgrid that is used with group by expressions and it shows 3 rows. It appears I'm having browser compatibility issues. In ie part of the grid is shown to the left and the other part is off to the right. In firefox it's displayed perfectly. I hope my explanation is understood, I also attached photos if each browsers presentation. Hopefully someone can help.

Thanks,
Ron.
Marin
Telerik team
 answered on 11 Apr 2013
1 answer
172 views
Hello

I want to HIDE & SHOW Rad Splitter from Client using jQuery, how do I achieve that?
Vessy
Telerik team
 answered on 11 Apr 2013
1 answer
60 views
Hi all,

I am using sample of (Grid - Client Edit with Batch Server Update)

Only different is I use  DataTable to bind the grid instance of using asp:SqlDataSource.

Dim objGetBillDoc As New XEFM.FmAcWoTransaction
Dim ds As New DataSet
ds = objGetBillDoc.GetBillingDocument(StrBillNo, strDocType, strTransporttype, strTradeType)
RadGrid1.DataSource = ds.Tables(
"BillingDocumentDetail")
RadGrid1.DataBind()


Problem is, When I click the header to sort, RadGrid1 is disapper.

Any suggestion which code need to be bind for sorting.
Shinu
Top achievements
Rank 2
 answered on 11 Apr 2013
3 answers
171 views
Following the online demos for Binding to Generic Lists and Defining Resources as a guide, I have attempted to use resources to style my appointments. 

After running DataBind(), I can see that each Appointment has a resource but when the scheduler loads up, the styles are not taking effect. When I look at the page's html source, the appointment element has class="rsApt " (notice the space), not class="rsApt User".

The Defining Resources example source shows class="rsApt Alex" or Charlie or Bob.  The Binding to Generic List examples source shows the same thing that I am seeing.

Is this a bug, or is this functionality that is not available when binding to generic lists?  Any Ideas?
Boyan Dimitrov
Telerik team
 answered on 11 Apr 2013
4 answers
107 views
Whenever I put HTML into the Group Header Item, as per Telerik instruction, eroneous "<p> </p>"
tags are being inserted above and below my content.
If I just have plain text (ie not HTML) then I don't get this behavour.
I need to use HTML to format my data/text.

This is my code, using literal but it didnt make any difference whether directly or via the literal.
protected void gridResults_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
 
    if (e.Item is GridGroupHeaderItem)
    {
        StringBuilder sb = new StringBuilder();
 
        sb.Append("<div style=\"width:500px; overflow-x:auto; overflow-y:hidden; \">");
        sb.Append("  <div style=\"width:400px;\">");
        sb.Append("    <div style=\"width:100px; float:left;\">Name </div>");
        sb.Append("    <div style=\"width:100px; float:left;\">Year Level </div>");
        sb.Append("    <div style=\"width:100px; float:left;\">Classes </div>");
        sb.Append("  </div>"); // row.
        sb.Append("</div>"); // table.
 
        GridGroupHeaderItem groupHeaderItem = (GridGroupHeaderItem)e.Item;
        Literal literal = new Literal();
        literal.Text = sb.ToString();
        groupHeaderItem.DataCell.Controls.Add(literal);
    }
}
PatrickS
Top achievements
Rank 1
 answered on 11 Apr 2013
4 answers
220 views
Hi

Is it possible to disable the content area of a PanelBar ie the RadPanelItem section., such that anything in the content are cant be clicked, but the sections can be expanded and collapsed.

Andy

Andy Green
Top achievements
Rank 2
 answered on 11 Apr 2013
3 answers
93 views
In my grid I have dynamically Created some Template Columns with TextBox as ItemTemplate control. My problem is that i couldnt
find that control When an external Save button is clicked. My code is here. Can anyone tell me what is the problem. Thanks in advance

  private void rgAddColumns()
        {
            int c = rgEmpOverTimeCalculation.Columns.Count;
 
            OvertimeTypeList objlist = new OvertimeTypeList();
            ListParams LP = new ListParams();
            LP.Add("@OvertimeTypeID", "%");
             
            LP.Add("Culture", SecurityUtility.Culture());
            objlist.GetList(LP);
 
            int TypeCount = objlist.Count;
            for (int k = 0; k < TypeCount; k++)
            {
                GridTemplateColumn Column = new GridTemplateColumn();
                
                Column.HeaderText = objlist[k].OvertimeType.ToUpper();
                Column.HeaderStyle.Font.Size =10;
                Column.HeaderStyle.ForeColor =System.Drawing.Color.Maroon;
                Column.HeaderStyle.Font.Bold = true;
                Column.UniqueName = objlist[k].OvertimeType.Replace(" ", String.Empty) + objlist[k].OvertimeTypeID;
                Column.Visible = true;
                 
                Column.ItemTemplate = new MyTemplate(Column.UniqueName);
 
                rgEmpOverTimeCalculation.MasterTableView.Columns.Add(Column);
            }
        }
 
 
public class MyTemplate : ITemplate
{
 
    protected RadNumericTextBox textBox;
    protected CheckBox boolValue;
    private string colname;
    public MyTemplate(string cName)
    {
        colname = cName;
    }
 
    
    public void InstantiateIn(System.Web.UI.Control container)
    {
 
        textBox = new RadNumericTextBox();
        textBox.ID = "txt"+colname;
        container.Controls.Add(textBox);
        
 
    }
 
}
   protected void rbtnSaveOvertime_Click(object sender, EventArgs e)
        {
            foreach (GridDataItem item in rgEmpOverTimeCalculation.MasterTableView.Items)
            {
                RadNumericTextBox txtOvertimeInHrs = (RadNumericTextBox)item[rgEmpOverTimeCalculation.Columns[5].UniqueName].FindControl("txt" + rgEmpOverTimeCalculation.Columns[5].UniqueName);     //returns null
            }
        }
Shinu
Top achievements
Rank 2
 answered on 11 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?