Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
213 views
Using a radgrid with AllowFilteringByColumn="true" I get this error:
“Invalid Column Name …”.

The SQL request used for data binding is :
SELECT myName AS [Another name] FROM TEST

So, I think the problem is the alias, but I don’t know how to solve it.

Could anyone help me, please?
Evelyne Schreiner
Top achievements
Rank 1
 answered on 15 Aug 2012
1 answer
166 views
Hi,

I have two raddatepicker columns as follows:
<telerik:GridTemplateColumn DataField="ItinDate" HeaderText="FromDate"  UniqueName="Date">
                                                <EditItemTemplate>
                                                    <telerik:RadDatePicker ID="ItinDateRadDatePicker" runat="server" Skin="Outlook"
                                                        DatePopupButton-TabIndex="-1" DbSelectedDate='<%# Bind("ItinDate") %>'  >
                                                     <ClientEvents OnDateSelected="CheckFromDate"  />
                                                    </telerik:RadDatePicker>
                                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ForeColor="Red"
                                                        ControlToValidate="ItinDateRadDatePicker" ErrorMessage="Invalid Date"
                                                        ValidationGroup="ItineraryGrid"></asp:RequiredFieldValidator>
                                                     
                                                </EditItemTemplate>
                                                
                                                <ItemTemplate>
                                                    <asp:Label ID="ItinDateLabel" runat="server"
                                                        Text='<%# Eval("ItinDate", "{0:MM/dd/yyyy}") %>'></asp:Label>
                                                    &nbsp;
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                             <telerik:GridTemplateColumn DataField="ItinToDate" HeaderText="ToDate"  UniqueName="ToDate">
                                                <EditItemTemplate>
                                                    <telerik:RadDatePicker ID="ItinToDateRadDatePicker" runat="server" Skin="Outlook"
                                                        DatePopupButton-TabIndex="-1" DbSelectedDate='<%# Bind("ItinToDate") %>' >
                                                         <ClientEvents OnDateSelected="CheckToDate"  />
                                                         
                                                    </telerik:RadDatePicker>
                                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator40" runat="server" ForeColor="Red"
                                                        ControlToValidate="ItinToDateRadDatePicker" ErrorMessage="Invalid Date"
                                                        ValidationGroup="ItineraryGrid"></asp:RequiredFieldValidator>
                                                  
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="ItinDateToLabel" runat="server"
                                                        Text='<%# Eval("ItinToDate", "{0:MM/dd/yyyy}") %>'></asp:Label>
                                                    &nbsp;
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>

I have CheckFromDate and CheckToDate javascript functions to validate these dates against the trip begin and end dates on my form.
My javascript code is as follows:

 function CheckFromDate(sender, args) {
        try {
            var itinStartDtInput = $("#ctl00_MainContent_ItineraryGrid_ctl00_ctl02_ctl03_ItinDateRadDatePicker_dateInput_text");
            var tripStartDt = $("#ctl00_MainContent_TripStartDate_dateInput_text").val();
            var parsedStartDate = Date.parse(tripStartDt);
            //StartDt = parsedStartDate.getMonth() + 1 + "/" + parsedStartDate.getDate() + "/" + parsedStartDate.getYear();
            //alert("Start Date " + StartDt);

            var tripEndDt = $("#ctl00_MainContent_TripEndDate_dateInput_text").val();
            var parsedEndDate = Date.parse(tripEndDt);

            var ItinFromDt = args.get_newValue();
            var parsedItinFromDate = Date.parse(ItinFromDt);
            // alert("ItinFromDate " + ItinFromDt);

            if (parsedItinFromDate < parsedStartDate || parsedItinFromDate > parsedEndDate) {
                alert("Itinerary from date has to be between trip begin and end dates");
                args.IsValid = false;
                //return false;
                //args.set_cancel(true);
                window.setTimeout(function () { itinStartDtInput.select(); }, 20);
 
            }
            
        }
        catch (ex) {
            alert(ex);

        }
       
    }

    //// Check for Itinerary to date to be between trip begin and end dates
    function CheckToDate(sender, args) {
        try {
            var itinEndDtInput = $("#ctl00_MainContent_ItineraryGrid_ctl00_ctl02_ctl03_ItinToDateRadDatePicker_dateInput_text");
            var tripStartDt = $("#ctl00_MainContent_TripStartDate_dateInput_text").val();
            var parsedStartDate = Date.parse(tripStartDt);
            //StartDt = parsedStartDate.getMonth() + 1 + "/" + parsedStartDate.getDate() + "/" + parsedStartDate.getYear();
            //alert("Start Date " + StartDt);

            var tripEndDt = $("#ctl00_MainContent_TripEndDate_dateInput_text").val();
            var parsedEndDate = Date.parse(tripEndDt);

            var ItinToDt = args.get_newValue();
            var parsedItinToDate = Date.parse(ItinToDt);
            // alert("ItinFromDate " + ItinFromDt);

            if (parsedItinToDate < parsedStartDate || parsedItinToDate > parsedEndDate) {
                alert("Itinerary to date has to be between trip begin and end dates");
                //args.IsValid = false;
                //return false;
                //args.set_cancel(true);
                window.setTimeout(function () { itinEndDtInput.select(); }, 20);
            }

        }
        catch (ex) {
            alert(ex);
        }
    }

My problem is when user input the ItinDate, it runs the CheckFromDate validation and then the hits ok on the popup alert message, and can tab through to the next field, even if the date entered is not between the trip begin and end dates. How do I ensure that the user enters a valid date (which is between the tripbegin and end dates) before they tab to the next field on the grid?

Thanks, Janaki
Galin
Telerik team
 answered on 15 Aug 2012
3 answers
162 views
I have a question. Is it possible to use JSON to query a web service and return a RadListViewItem (or preferably an array of them) to then append to the current listview on the page without a postback or lengthy ajax call? I have watched a few of the demos on how to use JSON and a web service but it didn't entirely help (new to JSON). Anyways, I am essentially making a commenting system and I want people to be able to load comments on demand and post new comments without experiencing a somewhat lengthy AJAX call using the panels or postingback completely. Right now when someone ads a new comment it actives the radajax components of the panel to make the call. It isn't terrible but I want something a little faster and seemless for the user. Let me know if something like this would work and if so, where I might start (specifically how to handle the return):

User wants to view more comments:

On page load (load top 30 results)
click "more" button and use JSON to get an array of RadListViewItems and append them to the current list view at the bottom (everything is ordered by date).

User wants to post:
Use JSON to write post to database (I can do this)
get the new record and return it as a RadListViewItem.

Thanks for all of your help guys.
Tsvetoslav
Telerik team
 answered on 15 Aug 2012
5 answers
447 views

 

hi
i have a standard grid with a series of columns in it i.e GridDropDownColumn, GridBoundColumn etc.
i want to know if there is a way of making the column a required field and validate it as such.
i know you can do it with a template column , but i dont want to have to create template columns for all the fields that require validation , there must be a simpler way to make a column a required field.
just to clarify this is for the insert/edit modes of the grid i need to validate the fields for.

thanks for your input on this.
Radoslav
Telerik team
 answered on 15 Aug 2012
1 answer
87 views
Hi,
I have a letter template which is populated in my treeView, I wanted to drag and drop template items to both radeditor and textbox. During drag I want to change it to hand cursor and whenever it dragover my editor or textbox it will highlight the control. Any way I could accomplish this, any sample that I could refer to?
Thanks in advance,
RJ
RJ
Top achievements
Rank 1
 answered on 15 Aug 2012
1 answer
87 views
I am using RadTreeView to display forum menu. I want to show an alert image for all the forum menu which have new reply. So I want to show/hide an image on databound similar we do in Radgrid on the rowDataBound event.

My Treeview don't have any child nodes. Below is my tree view node. Simply i bind this tree from database and onNodeClick i redirect to the another page.

<telerik:RadTreeView id = "radtree"  runat = "server" onNodeClick="radtreeNode_Click">
</telerik:RadTreeView >

Thanks
Puru

Puru
Top achievements
Rank 1
 answered on 15 Aug 2012
1 answer
81 views
I get the following error when I remove all rows from the grid source and rebind the grid.

Error: 'this.get_element().tBodies.0.rows' is null or not an object

This does not happen in IE7. It happened to me in IE8 and Firefox.

ASPX:
<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager" runat="server"></telerik:RadScriptManager>
    <telerik:RadAjaxPanel ID="RadAjaxPanel" runat="server">
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True"
            OnNeedDataSource="RadGrid1_NeedDataSource">
            <MasterTableView AutoGenerateColumns="True" ClientDataKeyNames="Id" DataKeyNames="Id" CommandItemDisplay="Top">
            </MasterTableView>
            <ClientSettings>
                <Selecting AllowRowSelect="True"></Selecting>
                <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadButton ID="RadButton1" runat="server" Text="RadButton"
            onclick="RadButton1_Click">
        </telerik:RadButton>
    </telerik:RadAjaxPanel>
    </form>

C#:

private Dictionary<int, string> GridSource
{
   get
   {
       return (Dictionary<int, string>) ViewState["gridSource"];
   }
   set
   {
       ViewState["gridSource"] = value;
   }
}
protected void Page_Load(object sender, EventArgs e)
{
   if (!IsPostBack)
   {
       GridSource = new Dictionary<int, string>();
 
       for (int i=0; i<2; i++)
       {
           GridSource.Add(i, "test data " + i);
       }
   }
}
 
protected void RadButton1_Click(object sender, EventArgs e)
{
   GridSource.Remove(int.Parse(RadGrid1.SelectedItems[0].Cells[2].Text));
   RadGrid1.Rebind();
}
 
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
   RadGrid1.DataSource = from d in GridSource select new { Id = d.Key, Text = d.Value };
}
Leonard
Top achievements
Rank 1
 answered on 15 Aug 2012
3 answers
136 views
Hi,

Please response to kassaiefarshad@yahoo.com

I have used a RadEditor in webpart on Sharepoint 2010.However, some buttons like "Image Manager" or "Document Manager" or "Hyperlink Manager" and so forth in Editor doesn't work and return an error.
error is such as follow:
Server Error in '/' Application.
________________________________________
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.
 
Requested URL: /_CONTROLTEMPLATES/Hojan.KMS.Webparts/KnowledgeEntry/Telerik.Web.UI.DialogHandler.aspx

any help appreciated.

Cheers,
Farshad


Vasu
Top achievements
Rank 1
 answered on 15 Aug 2012
3 answers
368 views
Is it possible to filter records onTextChanged or onKeyUp event of internal TextBox(Header TextBox) of Radgrid?
I dont want to select 'Start With', 'Contains' and other options from dropdown to filter records in Radgrid.

Find the attached file for more understanding...
Jayesh Goyani
Top achievements
Rank 2
 answered on 14 Aug 2012
2 answers
108 views
I can only seem to reproduce this in Chrome.  When a document is long enough to require a scrollbar, scrolling will put horizontal lines over the newly viewable part of the document. It seems to be related to the <td> which has a border that the iframe is in.  If I change the color of the border-bottom the lines output over the document change with it. I thought removing the border would resolve the issue, but it puts white lines over instead of black, transparent border has the same effect.  I can't seem to reproduce this in Chrome with regular iframes or any of the official demonstrations on this website.  

I have tried changing ContentAreaMode to DIV and although the lines do not appear with this it causes other issues so isn't a viable solution.

Any help anyone has would be much appreciated.
Brandon
Top achievements
Rank 1
 answered on 14 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?