Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
96 views
Hi,

we have the following structure of class definition for the datasource:

  public interface IActivityInstanceBase : IDataLayerBase
    {
        string Id { get; set; }
        DateTime ExecutionDate { get; set; }
        DateTime PlannedDate { get; set; }
.....
        string ActivityInstanceName { get; set; }
        string ParentId { get; set; } 
    }

    public interface IActivityInstance : IActivityInstanceBase, IExportable, IFileAddable
    {
        IMaintenanceGroup MaintenanceGroup { get; set; }
        IActivity Activity { get; set; }
        IActivityStatus Status { get; set; }
.....
        string MaintenanceGroupName { get; set; }
        string ParentGroupName { get; set; }
    }

Datasource is of type IActivityInstance which inherits IActivityInstanceBase (connected over needdatasource event)

I have to group by a field from the base class (ParentId) which is not possible (Exception field not found in datasource).

In the definition of grid columns i can also use fields from the base class, only in the group by expression it isn“t possible.

Any ideas how to solve that?

regards,
Stefan

Veli
Telerik team
 answered on 26 Feb 2010
1 answer
101 views
I am using declarative client side binding (my DataBinding declaration looks like the following)

<DataBinding Location="Services/StoryService.svc" FilterParameterType="Linq" SelectMethod="MethodName" SortParameterType="Linq" ></DataBinding>

But, I need to pass along some custom parameters (start and end date). I've seen past posts about this, but it seems that this wasn't possible previously. As this is probably necessary in 99% of business scenarios, I'm hoping that this functionality has been added. I have tried setting values within the grids client side DataBinding event, but it doesn't seem to recognize any custom parameters there (i.e. FilterExpression, MaximumRows, SortExpression, StartRowIndex)

What is the best way for me to specify custom parameters to be passed along to my WCF service call?

Yavor
Telerik team
 answered on 26 Feb 2010
6 answers
173 views
Hello,

I am faily new to Java script. I have tried following code to add 3 elements in the combobox. But it was not successful. Can you please correct me ? Its urgent.

 

 

 

var combo = $find('<%=RadComboType.ClientID%>');     
var comboItem = new Telerik.Web.UI.RadComboBoxItem();   
var inputtext = new Array("A", "B", "C");  
for(i=0; i<inputtext.length(); i++)  
{  
   comboItem.set_text(inputtext[i]);  
   combo.trackChanges();   
   combo.get_items().add(comboItem);   
   combo.commitChanges();  
}  

 

Yana
Telerik team
 answered on 26 Feb 2010
4 answers
218 views
I want to implement custom filtering on some of the columns in the grid.

I want to display filtering options based on a databse field like Status = {active,Inactive,Pending,All}
and display records from the database accordingly.

How can I implement this functionality?

Is it also possible to display a small button in the header column and on click of that button I pop-up a list with all the options?
Mark Galbreath
Top achievements
Rank 2
 answered on 26 Feb 2010
3 answers
208 views
Hi,
  I have rad grid with an edit template.
  The edit temlate has a table.
  The second row of this table had a RadComboBox.
  Based on the value in this combobox, I need to show or hide the next row. (e.g. If its a mobile chosen in the first dropdown, I want to show a dropdown for various mobile companies, however if the user choses houses, the company drop down should go away).
  It would be preferable to show or hide this row using javascript rather than an ajax postback.
Sabyasachi Dechaudhari
Top achievements
Rank 1
 answered on 26 Feb 2010
2 answers
292 views

I would like to programmatically create a RadPanelBar using data binding from an object that implements the IEnumerable interface.

 

Furthermore, I would like to dynamically add a RadGrid to each created RadPanelItem.

 

The following program code does what I want, but unfortunately I am not able to get the SelectedIndexChanged event working for the Grids, which are included within the RadPanelBar.

 

I suppose, the problem is that the Grids for the RadPanelBar are created to late within the Page Live Cycle, because they should be created OnInit and not on the ItemDataBound event of the RadPanelBar.

 

I don’t know how to dynamically add Grids to the RadPanelBar, which have been created early enough within the page life cycle in order to maintain their view state. Does anybody know a solution for this issue?

 

public class EOBDCode

    {

        public string Code { get; set; }               

        public EOBDCode() {}

    }

               

    public partial class _Default : System.Web.UI.Page

    {              

        private List<EOBDCode> GetEOBDCodesList()

        {

            List<EOBDCode> list = new List<EOBDCode>();

            EOBDCode code;

            for (int i = 0; i < 3; i++)

            {

                code = new EOBDCode();

                code.Code = "P00" + i;               

                list.Add(code);

            }

            return list;

        }

       

        protected void Page_Init(object sender, EventArgs e)

        {           

            placeHolder.Controls.Add(CreateGrid("RadGrid1"));

        }

 

        protected void Page_PreRender(object sender, EventArgs e)

        {

            RadPanel1.DataTextField = "Code";

            RadPanel1.DataSource = GetEOBDCodesList();

            RadPanel1.DataBind();           

        }

 

        private RadGrid CreateGrid(string id)

        {

            RadGrid grid = new RadGrid();

            grid.ID = id;

            grid.ClientSettings.Selecting.AllowRowSelect = true;

            grid.SelectedIndexChanged += Grid_SelectedIndexChanged;

            grid.NeedDataSource += Grid_NeedDataSource;

            grid.ClientSettings.EnablePostBackOnRowClick = true;

            return grid;

        }

 

        protected void RadPanel_ItemDataBound(object sender, RadPanelBarEventArgs e)

        {

            EOBDCode row = (EOBDCode)e.Item.DataItem;

            RadPanelItem item = new RadPanelItem();

            item.Controls.Add(CreateGrid(row.Code));

            e.Item.Items.Add(item);

        }

 

        protected void Grid_NeedDataSource(object sender, EventArgs ea)

        {

            RadGrid grid = (sender as RadGrid);

            grid.DataSource = GetEOBDCodesList();

        }

 

        protected void Grid_SelectedIndexChanged(object sender, EventArgs e)

        {

            //not called for Grids included within the RadPanelBar,

            //but called for the Grid within the placeholder.

        }

 

<body>

    <form id="form1" runat="server">           

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

    </telerik:RadScriptManager> 

    <div>

        <telerik:RadPanelBar ID="RadPanel1" runat="server" OnItemDataBound="RadPanel_ItemDataBound">      

        </telerik:RadPanelBar>

    </div>   

    <asp:PlaceHolder ID="placeHolder" runat="server"></asp:PlaceHolder>          

    </form>

</body>

Frank Lemmen
Top achievements
Rank 1
 answered on 26 Feb 2010
2 answers
141 views

Hi
Environment: RadControls for ASP.NET AJAX Q3 2009 / VS 2008 SP1/IE7/WINXP SP 2. 

I would like to conditionally hide or disallow the Update  in GridEditFormItem for certain users. For Example If the User is 'PR Manager', all add/update/edit/delete options will be available,  for others Radgrid will be read only.

I can hide the command items template without any problem but the problem is  when the Grid is in GridEditFormItem.   Just can't refer  the  EditCommandColumn1  (null exception error occurs) or hide its update text. 
Ideal solution will be if user is not 'PR Manager', only the cancel option will be available in GridEditFormItem. Below is my Radgrid and  Radgrid_Item Command.

Any help will be appreciated...


Thanks

GC_0620

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
 
        if ((Session["SessionUserEmplCategory"].ToString().Trim() != "PR Manager"))  
          
        {  
 
            // This works...  
            if (e.Item is GridCommandItem)  
            {  
                GridCommandItem cmdItem = (GridCommandItem)e.Item;  
               
                LinkButton btnedit = (LinkButton)cmdItem.FindControl("btnEditSelected");  
                btnedit.Visible = false;  
                 
                LinkButton btnupdate = (LinkButton)cmdItem.FindControl("btnUpdateEdited");  
                btnupdate.Visible = false;  
                LinkButton btnadd = (LinkButton)cmdItem.FindControl("BtnInitInsert");  
                btnadd.Visible = false;  
                 
                LinkButton btninsert = (LinkButton)cmdItem.FindControl("btnPerformInsert");  
                btninsert.Visible = false;  
 
                LinkButton btndelete = (LinkButton)cmdItem.FindControl("BtnDelete");  
                btndelete.Visible = false;  
 
                LinkButton btnCancel = (LinkButton)cmdItem.FindControl("btnCancel");  
                btnCancel.Visible = false;  
 
                LinkButton btnRefresh = (LinkButton)cmdItem.FindControl("btnRefresh");  
                btnRefresh.Visible = false;  
 
            }  

            //// Can't Hide the EditCommandColumn or hide its Update text.   
                     
           if (e.Item is  GridEditFormItem  && e.Item.IsInEditMode)  
            {  
            
             /// Allow only Cancel option if not 'PR Manager'

 

 

 

             GridEditFormItem EditFormcmdItem = (GridEditFormItem)e.Item;  
             EditFormcmdItem.FindControl("EditCommandColumn1").Visible = false;  
          }    
        }  

 Rad Grid:

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" 
        AllowSorting="True" 
           '''  
           '''" OnItemDataBound="RadGrid1_ItemDataBound">  
        <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top" Width="100%" Font-Size="11px"
 
            <CommandItemTemplate> 
                <div style="padding: 5px 5px;">  
                    Custom command item template&nbsp;&nbsp;&nbsp;&nbsp;  
                    <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Edit.gif" />Edit selected</asp:LinkButton>&nbsp;&nbsp;  
                    <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Update.gif" />Update</asp:LinkButton>&nbsp;&nbsp;  
                    <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Cancel.gif" />Cancel editing</asp:LinkButton>&nbsp;&nbsp;  
                    <asp:LinkButton ID="BtnInitInsert" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />Add new</asp:LinkButton>&nbsp;&nbsp;  
                    <asp:LinkButton ID="btnPerformInsert" runat="server" CommandName="PerformInsert" 
                        Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Insert.gif" /> Add this Attachment</asp:LinkButton>&nbsp;&nbsp;  
                    <asp:LinkButton ID="BtnDelete" OnClientClick="javascript:return confirm('Delete all selected Attachments?')" 
                        runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Delete.gif" />Delete selected Attachments</asp:LinkButton>&nbsp;&nbsp;  
                    <asp:LinkButton ID="BtnView" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Preview-icon.png" /> View selected</asp:LinkButton>&nbsp;&nbsp;  
                    <asp:LinkButton ID="btnRefresh" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Refresh.gif" />Refresh Attachment list</asp:LinkButton> 
                </div> 
            </CommandItemTemplate> 
            <Columns> 
                '''' ''''  
            </Columns> 
          
            <EditFormSettings> 
          
                <EditColumn InsertText="Insert" UpdateText="Update" UniqueName="EditCommandColumn1"  // Allow only Cancel if user is not 'PR Manager'
                    CancelText="Cancel">  
                </EditColumn> 
                <FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle> 
            </EditFormSettings> 

        </MasterTableView> 
        <ClientSettings> 
            <Selecting AllowRowSelect="True" /> 
            <ClientEvents OnCommand="gridCommand" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
gc_0620
Top achievements
Rank 1
 answered on 26 Feb 2010
1 answer
509 views
Hi

We have a web app that uses RadComboBoxes in a grid.  The last RadComboBox is right near the right margin of the screen.  On smaller screens when the user clicks on the drop down, the list appears but it is half off the screen to the right.  The browser scrollbar adjusts to the new width, however, when you click on the browser scroll bar to scroll over, the drop down list closes and the browser jumps back to the original width.

Even when using the scroll bar at the bottom of the dropdown list, you are unable to get the right hand scroll bar on the dropdown list to display (you can kind of get around this using the scroll wheel on the mouse).

Needless-to-say, this results in a very poor user experience.  Is there a way to get the dropdown list to respect the dimension of the browser window and only appear within its current bounds?
Yana
Telerik team
 answered on 26 Feb 2010
1 answer
60 views
Hello All,

I am using RadGrid in UserControl, and that user control call from aspx page,

I am using RadGrid with inline editing to insert, and update records, during editing when i click on save button(i.e. Image) that time it will fire the following event, and based on proxyAttendeeAvailable.IsInvitedOrBookedForAnyAgenda(eventAttendeeId, (System.DateTime)rdpDate.SelectedDate, (System.DateTime)rtpTimeFrom.SelectedDate, (System.DateTime)rtpTimeTo.SelectedDate) function result bind the javascipt function and it should fire the javascript function mention below, what was wrong with javascipt binding, and why javascipt function is not executed.

protected void rgAvailability_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (!e.Item.OwnerTableView.IsItemInserted)
            {
                AttendeeAvailableDateAndTimeService.AttendeeAvailableDateAndTimeClient proxyAttendeeAvailable = new ePlannerPro2Client.AttendeeAvailableDateAndTimeService.AttendeeAvailableDateAndTimeClient();

                try
                {
                    RadDatePicker rdpDate = e.Item.FindControl("txtAvailableDate") as RadDatePicker;
                    RadTimePicker rtpTimeFrom = e.Item.FindControl("txtTimeFrom") as RadTimePicker;
                    RadTimePicker rtpTimeTo = e.Item.FindControl("txtTimeTo") as RadTimePicker;

                    System.DateTime vsDate = System.Convert.ToDateTime(ViewState["AvailabilityDate"].ToString());
                    System.DateTime vsFromTime = System.Convert.ToDateTime(ViewState["AvailabilityTimeFrom"].ToString());
                    System.DateTime vsToTime = System.Convert.ToDateTime(ViewState["AvailabilityTimeTo"].ToString());

                    System.Guid eventAttendeeId = System.Guid.Empty;

                    if (CurrentUser != null && !CurrentUser.EventAttendeeId.Equals(System.Guid.Empty))
                    {
                        eventAttendeeId = CurrentUser.EventAttendeeId;
                    }

                    if (!vsDate.Equals(rdpDate.SelectedDate) || !vsFromTime.Equals(rtpTimeFrom.SelectedDate) || !vsToTime.Equals(rtpTimeTo.SelectedDate) && !System.Convert.ToBoolean(hfResult.Value))
                    {
                        if (proxyAttendeeAvailable.IsInvitedOrBookedForAnyAgenda(eventAttendeeId, (System.DateTime)rdpDate.SelectedDate, (System.DateTime)rtpTimeFrom.SelectedDate, (System.DateTime)rtpTimeTo.SelectedDate))
                        {
                            StringBuilder controls = new StringBuilder();
                            ImageButton updateBtn = e.Item.FindControl("UpdateButton") as ImageButton;

                            if (updateBtn != null)
                            {
                                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                                sb.Append(@"IsInvited('" + updateBtn.UniqueID + "');");
                                RadScriptManager.RegisterStartupScript(updateBtn, this.GetType(), "PopupUpdateMsg", sb.ToString(), false);
                                                               
                            }
                        }
                    }
                    else
                    {
                        hfResult.Value = "true";
                    }

                    bool isValid = false;

                    if (System.Convert.ToBoolean(hfResult.Value))
                    {
                        isValid = SubmitRecord(source, e);
                    }

                    if (isValid == false)
                    {
                        e.Canceled = true;
                    }
                }
                catch { }
                finally
                {
                    if (proxyAttendeeAvailable != null)
                    {
                        proxyAttendeeAvailable.Close();
                        proxyAttendeeAvailable = null;
                    }
                }
            }
}

<telerik:RadCodeBlock ID="RadCode" runat="server">
    <script language="javascript" type="text/javascript">
        function IsInvited(sender) {
            alert('Is Invited');
            document.getElementById("<%=hfResult.ClientID %>").value = false;

            var valid = confirm("One of the existing agenda falls outside the updated availibility date and time, would you like to continue?");
            if (valid) {
                document.getElementById("<%=hfResult.ClientID %>").value = valid;
                __doPostBack(sender, '');
                return true;
            }

            return false;
        }
</script>
</telerik:RadCodeBlock>

Thanks in Advance
Amit






Mira
Telerik team
 answered on 26 Feb 2010
1 answer
98 views
I have a form that has fields that are decorated using the RadInputManager along with it assigning them client side validation rules for numerics etc.

Below these fields I have a RadGrid that is disjoint in relation to those fields so I would like users to be able to fill in the grid or the fields in any order. I have the Grid set to use InPlace editing however attempting to insert a row in the grid triggers the validation of the InputManager also, how can I make it so the grid does not cause this validation to occur for those controls?
Princy
Top achievements
Rank 2
 answered on 26 Feb 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?