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

I have jquery method that will validate all the controls inside of a panel. It works fine for all the controls but RadDatePicker doesnt work.

The CssClass is set to "required" is overwritten by control's default class. It works fine for DateInput control as class is appended.

Here is the code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <p>
        &nbsp;</p>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            <asp:ScriptReference Path="~/Scripts/jquery.validate.js" />
            <asp:ScriptReference Path="~/Scripts/additional-methods.js" />
        </Scripts>
    </asp:ScriptManager>

    <script type="text/javascript">
        $(document).ready(function() {
            // Initialize validation on the entire ASP.NET form.
            $("#form1").validate({

                // This prevents validation from running on every
                //  form submission by default.
                onsubmit: false
            });

            // Search for controls marked with the causesValidation flag
            //  that are contained anywhere within elements marked as
            //  validationGroups, and wire their click event up.
            $('.validationGroup .causesValidation').click(ValidateAndSubmit);

            // Select any input[type=text] elements within a validation group
            //  and attach keydown handlers to all of them.
            $('.validationGroup :text').keydown(function(evt) {
                // Only execute validation if the key pressed was enter.
                if (evt.keyCode == 13) {
                    ValidateAndSubmit(evt);
                }
            });
        });

        function ValidateAndSubmit(evt) {
            // Ascend from the button that triggered this click event
            //  until we find a container element flagged with
            //  .validationGroup and store a reference to that element.
            var $group = $(evt.currentTarget).parents('.validationGroup');
            var isValid = true;

            // Descending from that .validationGroup element, find any input
            //  elements within it, iterate over them, and run validation on
            //  each of them.
            $group.find(':input').each(function(i, item) {

                if (!$(item).valid())
                    isValid = false;
            });

            // If any fields failed validation, prevent the button's click
            //  event from triggering form submission.
            if (!isValid)
                evt.preventDefault();
        }
    </script>

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        <asp:Panel ID="Panel1" runat="server" CssClass="validationGroup">
            <asp:TextBox ID="TextBox1" CssClass="required" runat="server"></asp:TextBox>
            <asp:DropDownList ID="DropDownList1" runat="server" CssClass="required">
               <asp:ListItem Text="Select One" Value=""></asp:ListItem>
               <asp:ListItem Text="test 1" Value="1"></asp:ListItem>
            </asp:DropDownList>
            <telerik:RadDatePicker ID="RadDatePicker1" CssClass="required" runat="server">
            </telerik:RadDatePicker>
            <telerik:RadDateInput ID="RadDateInput1" CssClass="required" runat="server">
            </telerik:RadDateInput>
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" CssClass="causesValidation" />
            <input id="Reset1" type="reset" value="reset" />
        </asp:Panel>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>

Veli
Telerik team
 answered on 06 Apr 2010
5 answers
490 views
Hi,
  Currently I have a requirement to add the grid control dynamically, this has NestedViewTemplate.
I was able to construct Grid on code behind as RadGrid r = new RadGrid(); How can I add NestedViewTemplate to this grid?
Manuel Ortiz
Top achievements
Rank 1
 answered on 06 Apr 2010
1 answer
136 views
Hello
 i am using the RadListView for displaying product boxes with ingress. i have following code


<telerik:RadListView runat="server" ID="products" Visible="false" ItemPlaceholderID="ProductItemContainer">
   <layouttemplate>
          <asp:PlaceHolder runat="server" ID="ProductItemContainer"/>
    </layouttemplate>
     <itemtemplate>
            <div class="<%=ArticleClassName%>">
                             <%#finArtTitle(CStr(DataBinder.Eval(Container.DataItem, "itemname")))%>
           </div>
   </itemtemplate>
</telerik:RadListView>


Now when i have place break-point for function "finArtTitle()" then i surprised to know that it fires for 16-times; when i have 4-products boxes (records).


Any suggestions / reasons please ?

Thanks.




Rosen
Telerik team
 answered on 06 Apr 2010
0 answers
83 views
Hello, i am working on rad schedular, and i print it in Portrait format, but now client wants to print it in landscape, any kind of help will be appreciated.
moftol
Top achievements
Rank 1
 asked on 06 Apr 2010
3 answers
258 views
Hello, the async upload works correctly (green checkmark) on my local (when i upload a file before postback) but when I push to my QA environment i get a red exclamation mark beside the file that I try to upload.  I was wondering if anyone knew what was wrong or if I forgot to add a permission to something on the QA server?

Let me know.

Thanks,


Jason
jasgrand
Top achievements
Rank 1
 answered on 05 Apr 2010
1 answer
283 views
am i using a old version or something???

the ddl version says: 2009.3.1103.20

I get unknown server tag trying to use the async upload control

<%@ Register tagprefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" %>

<telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" OnClientFileUploaded="fileUploaded"></telerik:RadAsyncUpload>

gives unknown server tag error

thanks for any help

Jessica Spaulding
Top achievements
Rank 1
 answered on 05 Apr 2010
2 answers
100 views
Hello,telerik.
When clicking the appointment on scheduler, how customize the form that shows only the subject , start date and finish date etc without adding and updating?

Ramie C
Top achievements
Rank 1
 answered on 05 Apr 2010
6 answers
129 views
Hi,

I have set a timer to fire every 3 seconds. In the timer's function call I am doing a .Rebind()

This causes the grid to disappear and reappear. 

I don't really want to re-render the whole grid - Ideally I would like to just update a couple of cells in the grid.

Is this possible?

thx
Martin Smith
Top achievements
Rank 1
 answered on 05 Apr 2010
3 answers
201 views
I've noticed that when you have DecoratedControls="CheckBoxes,RadioButtons" that the FormDecorater adds the class to the html element and causes my label tags to use the line-height property set by the FormDecorator css class. I know I could overwrite this by setting by explicitly setting the line-height of my label elements in css, but I thought that the FormDecorator would only add the classes to the control they are decoarting, rather than adding it in the html tag forcing any elements below it to follow it styles.

I also understand that the reason it's done this way is to simplify the decoration, but I think it would make more sense to add a class name to the checkbox or radiobutton labels, so that they are the only ones that are controlled by the FormDecorator, instead of other label elements which have nothing to do with the decorated controls.

I hope you could add something like that in your future update of the FormDecorator control.
Tsvetie
Telerik team
 answered on 05 Apr 2010
2 answers
585 views
Hello,

I have looked at several threads here on how to change row color but none seems to fit my requirement. I have a Rad grid that has GridEditCommandColumn and which has the ability to Update the records. My questions is how do I change the color of a row after a successful update. I am using Rad grid Item Command event to update my records:

Here is my code

ASPX:

<telerik:RadGrid runat="server" ID="rgGridResults" GridLines="None" Skin="BallState"
                AllowSorting="true" AllowPaging="true" AllowFilteringByColumn="true" AutoGenerateColumns="false"
                ShowGroupPanel="false" ShowFooter="true"
                OnNeedDataSource="rgGridResults_NeedDataSource"
                OnItemDataBound="rgGridResults_ItemDataBound"
                OnItemCommand="rgGridResults_ItemCommand">
                <ValidationSettings EnableValidation="true" ValidationGroup="vgGrid" />
                <MasterTableView EditMode="InPlace" DataKeyNames="donorid">
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="LinkButton" EditText="Edit" UpdateText="Update"
                            CancelText="Cancel" />
                        <telerik:GridBoundColumn HeaderText="Donor Name" DataField="name" SortExpression="name"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Donor ID" DataField="donorid" SortExpression="donorid"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Spouse ID" DataField="relttnid" SortExpression="relttnid"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Gift ID" DataField="giftid" SortExpression="giftid"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Pledge ID" DataField="pledgeid" SortExpression="pledgeid"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Credit Date" DataField="credtdat" SortExpression="credtdat"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Type" DataField="trantype" SortExpression="trantype"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Legal Amount" DataField="legal_credit" SortExpression="legal_credit"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Soft Credit Amount" DataField="legal_credit"
                            SortExpression="legal_credit" ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Soft Credit Amount" DataField="soft_credit"
                            SortExpression="soft_credit" ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Fund" DataField="fundnum" SortExpression="fundnum"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="Fund Name" DataField="fundname" SortExpression="fundname"
                            ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="System Review Code" DataField="needs_review_code"
                            SortExpression="needs_review_code" ReadOnly="true" />
                        <telerik:GridBoundColumn HeaderText="System Review Comment" DataField="needs_review_comment"
                            SortExpression="needs_review_comment" ReadOnly="true" />
                       
                        <telerik:GridTemplateColumn HeaderText="Encumbered Amount" DataField="match_eligible_amount"
                            SortExpression="match_eligible_amount" ReadOnly="true">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblEncumberedAmount" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Disbursed Amount" DataField="disburse_amount"
                            SortExpression="disburse_amount" ReadOnly="true">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblDisbursedAmount" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn HeaderText="Disbursed Date" DataField="disburse_date" SortExpression="disburse_date"
                            ReadOnly="true" />
                        <telerik:GridTemplateColumn HeaderText="Household Max" DataField="household_maximum_amt"
                            SortExpression="household_maximum_amt">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblHouseholdMax" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>

C# code:

protected void rgGridResults_ItemCommand(object sender, GridCommandEventArgs e)
        {
            GridDataItem gdiItem = e.Item as GridDataItem;

            if (gdiItem != null)
            {
                if (e.Item.IsInEditMode)
                {
                    switch (e.CommandName)
                    {
                        case "Update":
                            Page.Validate("vgGrid");

                            if (Page.IsValid)
                            {                                
                                int intDonorID;

                                if (int.TryParse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["donorid"].ToString(), out intDonorID))
                                {
                                    e.Item.CssClass = "RowColor";
                                   /* Data.Registered.Update(intGradID, intConfYear, tbxBadgeName.Text, rbtnlNotAttendingBsu.SelectedValue, rbtnlRsvp.SelectedValue,
                                                           rbtnlOffCampus.SelectedValue, rbtnlTeaching.SelectedValue, rbtnlResearch.SelectedValue, rbtnlLab.SelectedValue,
                                                           rbtnlOther.SelectedValue);

                                    //Call this method to update the total after the update is sucessfully completed.
                                    GetGridTotals();
                                    rgRegistered.Rebind();*/
                                }
                            }
                            else
                            {
                                rgGridResults.Controls.Add(new LiteralControl(string.Format("<span class=\"ErrorText\">There was an error updating the record.</span>")));
                            }
                            break;
                    }
                }
            }
        }

Kindly let me know a work around for this..

Thanks..
thecruciable
Top achievements
Rank 1
 answered on 05 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?