Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
205 views
I have a grid with a varchar(255). When displaying the grid, none of the values are even close to 255 characters But I am getting this error.  Any ideas as to why?
This is happening on Parent_NeedDataSource
Rusty
Top achievements
Rank 1
 answered on 05 Mar 2012
2 answers
340 views
I was referencing this post earlier: http://www.telerik.com/community/forums/aspnet/grid/radgrid-bind-dropdownlist-after-edit-mode.aspx. The problem with that is my grid item is never of type GridEditFormItem. Here's my method and template code.  How can I find and bind the DDL during edit mode of the row?

protected void MyAccountsGrid_ItemDataBound(object sender, GridItemEventArgs e)
 {
  if (e.Item.IsInEditMode)
  {
    // find the template control
  }
}

<telerik:RadGrid ID="MyAccountsGrid" AllowSorting="true" runat="server" AllowPaging="true" PageSize="20"
  AllowMultiRowSelection="true" AllowFilteringByColumn="true" EnableLinqExpressions="true" AllowAutomaticInserts="false" OnItemDataBound="MyAccountsGrid_ItemDataBound">
  <MasterTableView TableLayout="Auto" AutoGenerateColumns="false"
    AllowFilteringByColumn="true" CommandItemDisplay="Top"
    EditMode="InPlace" ClientDataKeyNames="Id,AccountNumber">
     
    <CommandItemSettings ShowAddNewRecordButton="true" AddNewRecordText="Add" />
      <telerik:GridTemplateColumn HeaderText="MyDDL" UniqueName="MyDDL">
        <HeaderTemplate>
          MyDDL
        </HeaderTemplate>
        <ItemTemplate>
          <%# Eval("AccountType") %>
        </ItemTemplate>
        <EditItemTemplate>
          <asp:DropDownList ID="accountTypeDDL" runat="server"></asp:DropDownList>
        </EditItemTemplate>
      </telerik:GridTemplateColumn>

Ryan
Top achievements
Rank 1
 answered on 05 Mar 2012
6 answers
557 views

Hi ,

I can't seem to bind the source from my datatable. It is not showing anything.

protected void grdDmnDocFolder_NeedDataSource(object o, GridNeedDataSourceEventArgs e)
    {
      DataTable dt = new DataTable();
  
  
      dt.Columns.Add("aaa");
      dt.Columns.Add("ccc");
      dt.Columns.Add("bbb");
  
      DataRow dr = dt.NewRow();
      dr["aaa"] = "a";
      dr["bbb"] = "b";
      dr["ccc"] = "c";
  
      dt.Rows.Add(dr);
      dt.Rows.Add(dr);
      dt.Rows.Add(dr);
      dt.Rows.Add(dr);
  
      grdDmnDocFolder.DataSource = dt;
  
    }

On my aspx page, i already set my OnNeedDataSource event as grdDmnDocFolder_NeedDataSource. What i'm trying to do here is just creating dummy records. What am i missing?

Please help.

Thank you.

Regards,
Dexter
Tsvetina
Telerik team
 answered on 05 Mar 2012
2 answers
72 views
Hi,
I am having issue accessing radwindow object. I am trying access it during radgrid_itemcommandobject.
My javascript function - as shown in the code below - "ShowDutyWindowClient" fails when it tries to get the radwindowmanager. Radwindowmanger object returns null.
I would appreciate help with this.

Thanks,
Manisha

Here is my code
//Usercontrol – codebehind
  
  
protected void rgDuty_ItemCommand(object source, GridCommandEventArgs e)
   {
            switch (e.CommandName)
            {
                case RadGrid.InitInsertCommandName:
                    e.Canceled =true;
                    long positionDescriptionID = CurrentPDID;
                    script = string.Format("ShowDutyWindowClient('{0}','{1}');", "Insert", positionDescriptionID);
    ScriptManager.RegisterStartupScript (this,this.GetType (),"showdutywindowClient" ,script,true  );
                    break;
                      
              case RadGrid.EditCommandName :
                    e.Canceled = true;
                    gridItem = e.Item as GridDataItem;
                    int dutyID = int.Parse(gridItem.GetDataKeyValue("DutyID").ToString());
                    script = string.Format("ShowDutyWindowClient('{0}','{1}');", "Edit", dutyID);
     ScriptManager.RegisterStartupScript (this,this.GetType (),"showdutywindowClient" ,script,true  );
                    break; 
 default:
                    RGQualEnabled = true;
                    break;
            }
        }
}
              
  
//UserControl Design 
<telerik:RadWindowManager ID="radWindowManagerDuties" runat="server" Behavior="Default"
    InitialBehavior="None" RegisterWithScriptManager="true">
    <Windows>
        <telerik:RadWindow ID="rwPDDuties" runat="server" RegisterWithScriptManager="true" 
        Skin="WebBlue" Height="600" Width="600" Behaviors="Close" VisibleStatusbar="false"
        ReloadOnShow="true">
        </telerik:RadWindow>
    </Windows>    
</telerik:RadWindowManager>
  
<telerik:RadCodeBlock ID="rcbCodeBlock" runat="server">
<script type="text/javascript">
 function ShowDutyWindowClient(mode, id) {
            var navigateurl;
            var title;
             
            if (mode == "Insert") {
                navigateurl = "~/CreatePD/AddEditDuty.aspx?mode=Insert&PositionDescriptionID=" + id;
                title = "Add Duty";
            }
            else {
                navigateurl = "~/CreatePD/AddEditDutyContent.aspx?mode=Update&DutyID=" + id;
                title = "Edit Duty";
            }
  
            var oWnd = radopen(navigateurl, "rwPDDuties");
        }            
  
  </script>
  
</telerik:RadCodeBlock>
Manisha Shivjiani
Top achievements
Rank 1
 answered on 05 Mar 2012
1 answer
128 views
Hello all!

I am getting a rather frustrating error with the RadAsyncUpload control.  When I attempt to set the TargetFolder and TemporaryFolder I am getting a "Object reference not set to an instance of an object" error.  It would seem that I am unable to dynamically set these folders.  I have tried setting them from server-side, as well as client-side using <%=strAsyncUploadFolder%>.  When I attempt to set it from client-side I get an error that says there are invalid characters within the path.  Any assitance with this would be very much appreciated.  We have several layers where the code exists (ie - local, QA and Production) and I would hate to have to keep changing static paths within the page rather than using nice and neat settings in the web.config file.

I have attached a screen-shot of the error I am getting, if it helps.
Eric
Top achievements
Rank 1
 answered on 05 Mar 2012
1 answer
67 views
Hello,

Dynamically I have added radscheduler in the sharepoint 2010 application page. I have set  "Telerik" theme for radscheduler it's working fine but in the browser 12 CSS files are loading for this particular control. It affects the page response as well as in Internet Explorer(7,8,9) upto  31 individual stylesheets are supported. 


Refer the below link
http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/ad1b6e88-bbfa-4cc4-9e95-3889b82a7c1d/ 


It affect the  page size and design.I have added the control in the page layout which resides inside master page. The CSS file count in the application page.


1. Master Page - 2 stylesheet 
2. Sharepoint  - 4 stylesheet 
3. Three RadTab and Radgrid controls - 15 stylesheet
5. RadScheduler - 12 stylesheet


If I have added Radscheduler,RadTab,Radgrid controls in the page totally 27 stylesheets are loaded in the page.So how to reduce the css file of the scheduler control and telerik RadTab,RadScheduler controls ? 
We are in a highly critical situation where our product release is held up because of the issues. Please respond at your as soon as possible. 


Regards
Ramalingam S
Kalina
Telerik team
 answered on 05 Mar 2012
1 answer
64 views
I have a custom validator attached to a date column in edit on an order entry system to insure that the user doesn't change the date to one already on another order item for that product
if the error is triggered in Firefox (but not in IE, Opera, Safari or Chrome) the date stops popping up for any other item on the page

the column from the grid
<telerik:GridDateTimeColumn UniqueName="ShipDate" DataField="ShipDate" PickerType="DatePicker" HeaderText="Ship Date" DataFormatString="{0:d}" DataType="System.DateTime" >
    <HeaderStyle Width="60px" />                    
</telerik:GridDateTimeColumn>
some Javascript
    var j = 0;
    function ship_date_selected(sender, eventArgs) {
        var date = eventArgs._newValue;
        // prevent loop
//        var chk = eventArgs._oldValue;
        if (j > 0) {
            return;
        }
        var oldDate = eventArgs.get_oldDate();
        var thisItem = document.getElementById('txtItemID');
        // date already for Item
        var theGrid = $find("<%=rgEditOrder.ClientID %>").get_masterTableView();
        var j = $find("<%=rgEditOrder.ClientID %>")._editIndexes[0];
        var editRow = theGrid.get_dataItems()[j];
        var thisStore = theGrid.getCellByColumnUniqueName(editRow, "StoreNumber").innerHTML;
        for (var i = 0; i < theGrid.get_dataItems().length; i++) {
            var row = theGrid.get_dataItems()[i];
            if (!row.get_isInEditMode()) {
                var ItemID = theGrid.getCellByColumnUniqueName(row, "ItemID").innerHTML;
                var storeNumber = theGrid.getCellByColumnUniqueName(row, "StoreNumber").innerHTML;
//              alert(ItemID);
                if (parseInt(ItemID) == parseInt(thisItem.value)) {
                    if (parseInt(storeNumber) == parseInt(thisStore)) {
                        var ShipDate = theGrid.getCellByColumnUniqueName(row, "ShipDate").innerHTML;
//                      alert(ShipDate);
                        if (Date.parse(date) == Date.parse(ShipDate)) {
                            alert('Date already used ' + ShipDate);
                            sender.set_selectedDate(oldDate);
                            i = 9999;
                            return false;
                        }
                    }
                }
            }
        }
         
        var strSD = format_dates(date);
        if (!delivery_ok(strSD)) {
            j++;
            sender.set_selectedDate(oldDate);
            alert('Invalid delivery date');
            return false;
            }
    }
    // validate that date supplied falls in one of three ship windows       
    function delivery_ok(strSD) {
        var endDate1 = document.getElementById('rtbEnd1');
        var endDate2 = document.getElementById('rtbEnd2');
        var endDate3 = document.getElementById('rtbEnd3');
        var startDate1 = document.getElementById('rtbStart1');
        var startDate2 = document.getElementById('rtbStart2');
        var startDate3 = document.getElementById('rtbStart3');
 
        // add century(20) to ship dates-mm/dd/yy->mm/dd/yyyy           
        var vDate1 = format_dates(startDate1.value);
        var vDate2 = format_dates(startDate2.value);
        var vDate3 = format_dates(startDate3.value);
        var vEnd1 = format_dates(endDate1.value);
        var vEnd2 = format_dates(endDate2.value);
        var vEnd3 = format_dates(endDate3.value);
 
        if (vDate1 != '') {
            if (Date.parse(strSD) >= Date.parse(vDate1) && Date.parse(strSD) <= Date.parse(vEnd1)) {
                return true;
            }
        }
        if (vDate2 != '') {
            if (Date.parse(strSD) >= Date.parse(vDate2) && Date.parse(strSD) <= Date.parse(vEnd2)) {
                return true;
            }
        }
        if (vDate3 != '') {
            if (Date.parse(strSD) >= Date.parse(vDate3) && Date.parse(strSD) <= Date.parse(vEnd3)) {
                return true;
            }
        }
        return false;
    }
    // append century(20) to date-mm/dd/yy->mm/dd/yyyy
    // validate that date is in correct format-if error found
    // return blank string       
    function format_dates(strDate) {
        var i = 0;
        var arrDate;
        // this routine makes no sense           
        for (i = 0; i < 3; i++) {
            if (strDate.indexOf("/") != -1) {
                arrDate = strDate.split("/");
                if (arrDate.length != 3) {
                    return "";
                }
            }
            else {
                return "";
            }
        }
 
        // prefix the year with century-hardcoded 20                
        var ye = "20" + arrDate[2].substring(arrDate[2].length - 2);
        var month = Number(arrDate[0]);
        var day = Number(arrDate[1])
        // check month and day-month between 1 and 12,day between 1 and 31
        // except April,June,September and November-and February
        if (month < 1 || month > 12) { return ""; }
        if (day < 1 || day > 31) { return ""; }
        if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
            return "";
        }
        // February-check against leap year
        if (month == 2) {
            var isleap = (ye % 4 == 0 && (ye % 100 != 0 || ye % 400 == 0));
            if (day > 29 || (day == 29 && !isleap)) { return ""; }
        }
 
        // no date errors encountered-rebuild date and return
        var strD = Number(arrDate[0]) + "/" + Number(arrDate[1]) + "/" + ye;
        return strD;
    }

decorate the edit item
  protected void rgEditOrder_ItemCreated(object source, GridItemEventArgs e)
  {
      GridEditableItem geItem;
//    GridDataItem gdItem;
      RadDatePicker rdpShipDate;
      GridDateTimeColumnEditor ceShipDate;
      TableCell tcShipDate;
      CustomValidator cvShipDate;
      RadNumericTextBox rntbQty;
//    int MinQty;
 
      if (e.Item.IsInEditMode)
      { }
      else
          return;
 
      if (e.Item is GridEditableItem)
      { }
      else
          return;
 
      geItem = (GridEditableItem)e.Item;
      rdpShipDate = (geItem["ShipDate"].Controls[0] as RadDatePicker);
      rdpShipDate.ClientEvents.OnDateSelected = "ship_date_selected";
      rdpShipDate.AutoPostBack = true;    
      rdpShipDate.SelectedDateChanged += rdpShipDate_SelectedDateChanged;
      txtShipDate.Value = rdpShipDate.ClientID;
 
      ceShipDate = geItem.EditManager.GetColumnEditor("ShipDate") as GridDateTimeColumnEditor;
      tcShipDate = (TableCell)ceShipDate.PickerControl.Parent;
      cvShipDate = new CustomValidator();
      cvShipDate.ID = "cvShipDate";
      cvShipDate.ControlToValidate = rdpShipDate.ID;
      cvShipDate.ServerValidate += ShipDate_OnServerValidate;
      cvShipDate.Text = "*";
      cvShipDate.ErrorMessage = "Item already ordered on this ship date";
      tcShipDate.Controls.Add(cvShipDate);
 
  }

am I going about it the wrong way - or is there - gasp! - a bug?
I'm using the Q3 2011 version
Elliott
Top achievements
Rank 2
 answered on 05 Mar 2012
11 answers
307 views
I'm interested in building a webpart that is essentially the RADScheduler - this will replace the default Sharepoint calendar. I've read several articles on how to create basic webparts with telerik controls, but how would you go about building this webpart as a "fully functional" version of the Scheduler.

Basically I want to be able to give users the option via the webpart editor to select a sharepoint list(s) to pull its information from. The list would need to be a calendar list and extra columns would automatically be reflected by the webpart.

For instance, if the calendar list has a "Color" column then that instance of the scheduler would have a Color selection combo box. If the calendar list had a checkbox field called "Active" then that instance of the scheduler would also have a checkbox field called active.

Another option would be to automatically create a list to store the information when the webpart is initialized. This would likely be the default behaviour.

We've tried several webparts to replace the default calendar component in MOSS and nothing comes close to Telerik's Scheduler. The only problem is that it's a control and not a webpart - a "do it yourself" module sounds good, but I'm oblivious to how it would integrate as a webpart with all of the functionality it possesses.

Please let me know if this type of integration is possible without an extremely large amount of coding.
Chad
Top achievements
Rank 1
 answered on 05 Mar 2012
1 answer
81 views
I would like to compare each row in a radgrid with the one above it to highlight changes. None of the rows will be selected so i need to somehow get the data for each row and compare it after binding. Is there a way for me to access all of the data in the grid if a row isn't selected?
Casey
Top achievements
Rank 1
 answered on 05 Mar 2012
3 answers
70 views
Trying to export the grid results to excel using IE9.  I can not click open.  I can only save.  When clicking opern it says the file is not available.  If I retry it recreates a screen shot of the current page and not the entire dataset.  This will work in Firefox.
Kevin
Top achievements
Rank 1
 answered on 05 Mar 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?