Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
108 views
how to create unbound gridview br telerik grid  and save to database
Maria Ilieva
Telerik team
 answered on 10 Nov 2015
3 answers
196 views

I have a user control creates a control which includes a RadDateTimePicker. The datetimepicker has a SelectedDateChanged event that fires and runs the code accordingly. Since it is dynamically created, I need to dynamically add it to the RadAjaxManager that already exists. My current approach doesn't seem to work, and I get a full postback.

 

User Control

 

public partial class CategoryHolder : System.Web.UI.UserControl
    {
        public string _category;
        public string _mptt;
        public DateTime _startDate;
        public DateTime _endDate;
        public EventHandler startDateChanged;
        public EventHandler endDateChanged;
 
 
        public string Category
        {
            get
            {
                return _category;
            }
 
            set
            {
                _category = value;
 
 
            }
        }
 
        public string MPTT
        {
            get
            {
                return _mptt;
            }
 
            set
            {
                _mptt = value;
                
 
            }
        }
 
        public DateTime StartDate
        {
            get
            {
                return _startDate;
            }
 
            set
            {
                _startDate = value;
                 
 
            }
        }
 
        public DateTime EndDate
        {
            get
            {
                return _endDate;
            }
 
            set
            {
                _endDate = value;
                 
            }
        }
 
        protected void Page_Init(object sender, EventArgs e)
        {
 
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            Label lbl = new Label();
            HiddenField hf = new HiddenField();
            RadDateTimePicker start = new RadDateTimePicker();
            RadDateTimePicker end = new RadDateTimePicker();
 
            start.AutoPostBack = true;
            start.SelectedDateChanged += new Telerik.Web.UI.Calendar.SelectedDateChangedEventHandler(start_SelectedDateChanged);
            start.ClientIDMode = System.Web.UI.ClientIDMode.Static;
            start.ID = MPTT + "StartControl";
            start.DatePopupButton.Visible = false;
            start.TimePopupButton.Visible = false;
 
            end.AutoPostBack = true;
            end.SelectedDateChanged += new Telerik.Web.UI.Calendar.SelectedDateChangedEventHandler(end_SelectedDateChanged);
            end.ClientIDMode = System.Web.UI.ClientIDMode.Static;
            end.ID = MPTT + "EndControl";
            end.DatePopupButton.Visible = false;
            end.TimePopupButton.Visible = false;
             
 
            lbl.Text = Category;
            hf.Value = MPTT;
            start.SelectedDate = StartDate;
            end.SelectedDate = EndDate;
 
            this.Controls.Add(lbl);
            this.Controls.Add(hf);
            this.Controls.Add(start);
            this.Controls.Add(end);
 
        }
 
 
        void start_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
        {
            if (this.startDateChanged != null)
            {
                this.startDateChanged(this, e);
            }
        }
 
        void end_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
        {
            if (this.endDateChanged != null)
            {
                this.endDateChanged(this, e);
            }
        }
    }

 

Test Page using control:

 

<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="rsm" runat="server"></telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="ram" runat="server"></telerik:RadAjaxManager>
    <div>
    <asp:PlaceHolder ID="Placeholder" runat="server"></asp:PlaceHolder>
    </div>
    </form>
</body>
</html>

Test Page C#:

protected void Page_Load(object sender, EventArgs e)
 {
     CategoryHolder ch = new CategoryHolder();
 
     ch.Category = "Test Category";
     ch.MPTT = "dfdfdopfksdopfsdop";
     ch.StartDate = DateTime.Today;
     ch.EndDate = DateTime.Today.AddDays(5);
     ch.startDateChanged += new EventHandler(startPicker_SelectedDateChanged);
 
     RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
     RadAjaxLoadingPanel loadingPanel = new RadAjaxLoadingPanel();
 
     Placeholder.Controls.Add(ch);
 
     manager.AjaxSettings.AddAjaxSetting(ch, ch, loadingPanel);
     manager.AjaxSettings.AddAjaxSetting(ch, Placeholder, loadingPanel);
 }
 
 void startPicker_SelectedDateChanged(object sender, EventArgs e)
 {
     //Yay it runs, but on a full postback
 }

Maria Ilieva
Telerik team
 answered on 10 Nov 2015
12 answers
210 views
Hi,

I'm trying to work out why my code isn't working with the  "control_name.EmptyMessage = message" type command from server side code.  It works when running in the initial page load but then on ajax calls it doesn't set the fields.

Also in Javascript the set_emptyMessage command doesn't seem to work on a similar basis...Interestingly I can use the set_text command to acheive the same goal. 

Is there a known bug with the emptymessage commands or will I need to post some code?

Regards,

Jon
Helen
Telerik team
 answered on 10 Nov 2015
1 answer
94 views

I have the following setup in my RadGrid lines in bold contain my database table primary key named LinkAnalysisId

<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="LinkAnalysisId" HeaderText="Link ID" ReadOnly="true"
ForceExtractValue="Always" ConvertEmptyStringToNull="true" Display="False" />
<telerik:GridHyperLinkColumn FilterControlAltText ="Filter LinkID2 column"
Uniquename="LinklId2" DataNavigateUrlFormatString ="/SubjectList2.aspx?LinkID={0}"
DataTextField="LinkAnalysisName" HeaderText="Link Analysis Name"
DataNavigateUrlFields="LinkAnalysisId" />

<telerik:GridBoundColumn DataField="LinkAnalysisName" HeaderText="LinkAnalysisName" SortExpression="LinkAnalysisName"
UniqueName="LinkAnalysisName" Display="False">

Other bound columns are not shown  when I update a records and try to save I run this C# code

protected void RadGrid1_UpdateCommand(object sender, Web.UI.GridCommandEventArgs e)
        {        
               var editableItem = ((GridEditableItem)e.Item);
 
           var linkAnalysisId = (int)RadGrid1.MasterTableView.Items[0].GetDataKeyValue("LinkAnalysisId");
           
              //retrive entity from the Db
 
           var record = DbContext.LinkAnalysis.Where(n => n.LinkAnalysisId == linkAnalysisId).FirstOrDefault();
 
              if (record != null)
              {
                  //update entity's state
                  editableItem.UpdateValues(record);
                  try
                  {
                      //save chanages to Db
                      DbContext.SaveChanges();
                  }
                  catch (System.Exception)
                  {
                      ShowErrorMessage();
                  }
 
             }
       }
     The save does not pass the try catch block  I have done some trouble shooting and I have found the code      

var linkAnalysisId = (int)RadGrid1.MasterTableView.Items[0].GetDataKeyValue("LinkAnalysisId");

which sets the linkAnalysis variable is not getting the correct ID number so it appears I have something wrong. In debug mode when I inspect the values in the var editableItem I am seeing the correct linkAnalysis ID number it is just the code above is not getting the right record what have I done wrong here?

 

Thanks

Perry
Top achievements
Rank 1
 answered on 10 Nov 2015
2 answers
158 views

I have a RadGrid with the following CommandItemTemplate items

<asp:Button ID="Diagram" Text="Diagram" runat="server" OnClick="DiagramClicked"></asp:Button>
<asp:CheckBox ID="OrphanCheck" Text="Exclude Orphans" runat="server"/>

When the user clicks the Diagram button, using C#  I want to read the value of the Checkbox and build the needed code based on the value of the check box.  How can I get the value of that checkbox.  I have searched for a solution but all I can find is dealing with a checkbox in a column or row.

 

Thanks

Perry

Perry
Top achievements
Rank 1
 answered on 10 Nov 2015
1 answer
55 views

Hello  there,

 

I have  a requirement of Set PasswordStrengthSettings 's TextStrengthDescriptionStyles and TextStrengthDescriptions based on the following condions. how do i acheive it.

 

if(args.get_strengthScore() > 0 & args.get_strengthScore() <20)

{

Red colour RadStrength Strip and With Text "week"

}

else if(args.get_strengthScore() >​ 20 & args.get_strengthScore() <40)
{
Yellow colour RadStrength Strip and With Text "​Poor"

}

 

 

How do i acheive it??

Vessy
Telerik team
 answered on 10 Nov 2015
11 answers
550 views
Hi,
How can i achive Tab or Right Key press and change the selected grid cell to next Cell.
For example i have 10 Column and 10 rows in a grid.
IF i click on first row cell of Colum[0] and press Tab Key or Right Arrow Key the selected cell should move to next cell .Same like Excel
Kostadin
Telerik team
 answered on 10 Nov 2015
1 answer
70 views

Bullet charts are a supported vizualization in Kendo, MVC, and others but ​​​do not seem to be supported in HtmlChart, at least not like sparklines are. Is there any work-around for rendering them using HtmlChart?

Thanks,

Terry

Danail Vasilev
Telerik team
 answered on 10 Nov 2015
5 answers
188 views
Hello Telerik Team,

We have used the UI for ASP.NET AJAX Telerik toolkit in our application. Recently we have upgraded the Telerik version from older version “2012.2.724.35” to the new version “2014.2.724.45”. After upgrading the Telerik version we are facing some functionality issues. We need your help on identifying the fix for following mentioned issue. 

Following is the issue which we are facing after upgrading Telerik Version to “2014.2.724.45” i.e. UI for ASP.NET AJAX Q2 2014

Issue: Basically the issue is that, we have used RadContext menu with the Telerik Grid controls if there are few columns visible in the Grid and if we click to open the context menu it displays the menu properly and at the desired position, refer the image “BeforeTelerikUpgrade”.
Now the issue is that when there are more columns visible in the grid then the “Horizontal Scroll bar” appears at the bottom of the page so that we can scroll and view all the grid columns, now when the horizontal scroll bar is visible and if we click on the “Context Menu” then in this case the context menu is displayed but its position is misplaced and it do not appear at item where it should actually be displayed, refer the image “AfterTelerikUpgrade”.

The Context Menus used to display and work as desired in the previous Telerik version “2012.2.724.35” but after we have upgraded the Telerik to the new version “2014.2.724.45” we are facing this issue.

Please can anyone help us to identify the fix for this problem which we are facing?

Thanks in advance,
Riz 
Magdalena
Telerik team
 answered on 10 Nov 2015
4 answers
100 views

I have two RadGrids for showing main and detail data.

I wanted to have an asp:FileUpload in the WebUserControl Editform, so I  made a button to upload, save the new InsertItem and Redirect to the same page, opening the EditForm for the newly inserted item in RadGrid2 as shown here: http://www.telerik.com/forums/how-to-use-a-hyperlink-column-to-redirect-to-a-new-and-load-details-in-a-radgrid.

Then, on DataBind, the second Grid throws the following error:

[ArgumentNullException: Der Wert darf nicht NULL sein.
Parametername: virtualPath]
   System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) +9893937
   System.Web.UI.TemplateControl.LoadControl(String virtualPath) +18
   Telerik.Web.UI.GridEditFormItem.InitializeUserControlForm(GridColumn[] columns, ControlCollection controls, GridEditFormSettings formSettings) +123
   Telerik.Web.UI.GridEditFormItem.InitializeEditForm(GridColumn[] columns) +6009
   Telerik.Web.UI.GridEditFormItem.Initialize(GridColumn[] columns) +373
   Telerik.Web.UI.GridEditFormItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +340
   Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +1155
   Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +211
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +3172
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +1150
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +67
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +34
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
   Telerik.Web.UI.GridTableView.PerformSelect() +38
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   Telerik.Web.UI.GridTableView.DataBind() +392
   Telerik.Web.UI.RadGrid.DataBind() +191
   Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +4238
   Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +201
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
Jan
Top achievements
Rank 1
 answered on 10 Nov 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?