Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
394 views
 

Hi

I am using RadGrid With Paging(Mode:NextPrevAndNumeric).

Issue:-

The Problem is when i change the Page Size From the dropdown Let's say 2 to 10. then there is no record Display even the Grid has 5 records.

This Problems has Come after I implemented the "expand/collapse images when no records" in the grid followed your tetelrik article.

If I do the, Hieararchy Load Mode="Server" or remove "expand/collapse images when no records" behaviour then it's works fine.

But I need Both feature..

I also Attached the Code and Images

 

<

 

telerik:RadGrid AutoGenerateColumns="False" ID="rgSurvey" AllowPaging="True" AllowSorting="True"

 

                AllowCustomPaging="True" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"
                AllowAutomaticDeletes="true" OnItemCommand="rgSurvey_ItemCommand" OnSortCommand="rgSurvey_SortCommand"
                OnNeedDataSource="rgSurvey_NeedDataSource" runat="server" Skin="Office2007" PageSize="20"
                ShowGroupPanel="false" ClientSettings-AllowDragToGroup="true" ClientSettings-AlowExpandCollapse="true"
                OnDetailTableDataBind="rgSurvey_DetailTableDataBind" DataMember="SurveyTemplateID"
                OnItemDataBound="rgSurvey_ItemDataBound"  OnPreRender="rgSurvey_PreRender"
                <PagerStyle Mode="NextPrevAndNumeric" />
                <MasterTableView TableLayout="Fixed" DataKeyNames="SurveyTemplateID" HierarchyDefaultExpanded="false"
                    CommandItemDisplay="None" CommandItemSettings-AddNewRecordText="Add New User" HierarchyLoadMode="Client">
                    <DetailTables>
                        <telerik:GridTableView AllowPaging="false" AllowSorting="false" >
                            <Columns>
<telerik:GridTemplateColumn UniqueName="LockUnlock" HeaderText="" HeaderStyle-Width="70"
                                        ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70">
                                        <itemtemplate
                                         <asp:ImageButton ID="Image1" runat="server" OnClientClick="return checkuserlock(this);" CommandName="UnlockSurvey" /> <br />
                                         <asp:Label ID="lblLockUserName" runat="server" Text='<%# Eval("LockUserName") %>' />
                                         <asp:Label ID="lblInnerLockUserId" runat="server" Text='<%# Eval("LockUserID") %>' style="display:none;"></asp:Label>
                                       </itemtemplate>
                                       </telerik:GridTemplateColumn>                                
                                <telerik:GridBoundColumn HeaderText="Version" DataField="SurveyVersion" HeaderStyle-Width="40">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="ID" DataField="SurveyTemplateID" UniqueName="SurveyTemplateID"
                                    SortExpression="SurveyTemplateID" HeaderStyle-Width="40" />
                                <telerik:GridButtonColumn HeaderText="Title" DataTextField="SurveyName" UniqueName="SurveyName"
                                    ItemStyle-Font-Bold="false" SortExpression="SurveyName" CommandName="editcontent" />
                                <telerik:GridBoundColumn HeaderText="Created By" DataField="UserNAME">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Last Updated By" DataField="LastUpdatedUser">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Approved By" DataField="ApprovedBy">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Active Date" DataField="ActiveDate">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Termination Date" DataField="TerminationDate">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Approval Status" DataField="ApprovalStatus">
                                </telerik:GridBoundColumn>
                                 <telerik:GridBoundColumn HeaderText="" DataField="LockUserID" Visible="false">
                            </telerik:GridBoundColumn>
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    <Columns>
<telerik:GridTemplateColumn UniqueName="LockUnlock" HeaderText="" HeaderStyle-Width="70"
                            ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70">
                            <ItemTemplate>
                                <asp:ImageButton ID="Image1" runat="server" OnClientClick="return checkuserlock(this);" CommandName="UnlockSurvey"/><br />
                                <asp:Label ID="lblLockUserName" runat="server" Text='<%# Eval("LockUserName") %>' />
                                <asp:Label ID="lblLockUserId" runat="server" Text='<%# Eval("LockUserID") %>' style="display:none;"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn HeaderText="Version" DataField="SurveyVersion" HeaderStyle-Width="40">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="ID" DataField="SurveyTemplateID" UniqueName="SurveyTemplateID"
                            SortExpression="SurveyTemplateID" HeaderStyle-Width="40" />
                        <telerik:GridButtonColumn HeaderText="Title" DataTextField="SurveyName" UniqueName="SurveyName"
                            ItemStyle-Font-Bold="true" ItemStyle-ForeColor="Red" SortExpression="SurveyName"
                            CommandName="editcontent" />
                        <telerik:GridBoundColumn HeaderText="Created By" DataField="UserNAME" SortExpression="UserNAME">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Last Updated By" DataField="LastUpdatedUser"
                            SortExpression="LastUpdatedUser">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Approved By" DataField="ApprovedBy" SortExpression="ApprovedBy">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Active Date" DataField="ActiveDate" SortExpression="ActiveDate">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Termination Date" DataField="TerminationDate"
                            SortExpression="TerminationDate">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Approval Status" DataField="ApprovalStatus"
                            SortExpression="ApprovalStatus">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="" DataField="LockUserID" Visible="false">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
  
protected override void OnLoad(EventArgs e)
        {
  
            base.OnLoad(e);
  
            if (!Page.IsPostBack)
            {
 this.rgSurvey.PageSize = 2;
  }
        }
  
 protected void rgSurvey_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            if (!e.IsFromDetailTable)
            {
                                SetSurveyContentGridDataSource();
               
                            }
        }
  
  
  
  private void SetSurveyContentGridDataSource()
        {
            int totalRecord = 0;
            this.rgSurvey.DataSource = GetSearchBySurvey(ref totalRecord);
            this.rgSurvey.VirtualItemCount = totalRecord;
                   }
  
private List<GetSearchSurveyResult_Result> GetSearchBySurvey(ref int totalRecord)
        {
            string approvalstatus = string.Empty;
            SurveyQuestionBL oSurveyCategory = new SurveyQuestionBL();
            int pageSize = this.rgSurvey.PageSize;
            string sortExpression = GetSortedColumnName("SURVEY");
            string sortDirection = GetSortedDirection("SURVEY");
  
            foreach (ListItem li in cbApprovalStatus.Items)
            {
                if (li.Selected == true)
                {
                    approvalstatus += li.Value + ",";
                }
            }
            GetSearchSurveyResult_Result obj = new GetSearchSurveyResult_Result
            {
                SurveyTemplateID = txtSurveyID.Text.Length > 0 ? Convert.ToInt32(txtSurveyID.Text) : 0,
                SurveyName = txtSurveyTitle.Text,
                SurveyScopeID = Convert.ToInt32(rblScope.SelectedValue),
                ApprovalStatusID = approvalstatus,
                ClientID = Convert.ToInt32(rblScope.SelectedValue) ==(int) Scope.ClientSpecific ? (int?)Convert.ToInt32(ddlClientList.SelectedValue) : null
  
            };
            //int pageSize = this.rgSurvey.PageSize;
            var list = oSurveyCategory.GetAllSurveyResult(pageSize, obj, rgSurvey.CurrentPageIndex, ref totalRecord, sortExpression, sortDirection);
            oSurveyCategory = null;
            return list;
  
        }
  
protected void rgSurvey_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            SurveyQuestionBL oReportingCategory = new SurveyQuestionBL();
            // int record;          
            GridDataItem parentItem = e.DetailTableView.ParentItem as GridDataItem;
            string surveyTemplateID = parentItem.GetDataKeyValue("SurveyTemplateID").ToString();
            this.rgSurvey.DataSource = oReportingCategory.GetNestedSurveyById(Convert.ToInt32(surveyTemplateID));
            //this.rgSurvey.AllowPaging = false;
  
  
        }
  
  protected void rgSurvey_PreRender(object sender, EventArgs e)
        {
            HideExpandColumnRecursive(rgSurvey.MasterTableView);
        }
        public void HideExpandColumnRecursive(GridTableView tableView)
        {
            GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);
            foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
            {
                foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
                {
                    if (nestedView.Items.Count == 0)
                    {
                        TableCell cell = nestedView.ParentItem["ExpandColumn"];
                        cell.Controls[0].Visible = false;
                        nestedViewItem.Visible = false;
                    }
                    if (nestedView.HasDetailTables)
                    {
                        HideExpandColumnRecursive(nestedView);
                    }
                }
            }
        }
  
 protected void rgSurvey_SortCommand(object source, GridSortCommandEventArgs e)
        {
            // if (rblSearchType.SelectedValue == "1")
            //{
            SetSortedColumnName("SURVEY", e.CommandArgument.ToString());
            SetSortedDirection("SURVEY", e.NewSortOrder.ToString());
            BindContentSurveyGrid();
}
  protected void rgSurvey_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            Int32 SurveyId, dbResult;
            int LockUserID, Edit;
            SurveyQuestionBL oReportingCategory;
            if (e.CommandName == "editcontent")
            {
  
                oReportingCategory = new SurveyQuestionBL();
                GridDataItem item = (GridDataItem)e.Item;
                SurveyId = Convert.ToInt32(item["SurveyTemplateID"].Text);
                LockUserID = Convert.ToInt32(item["LockUserID"].Text);
  
                if (LockUserID == 0 || LockUserID == base.UserID)
                {
                    dbResult = oReportingCategory.InsertSurveyForLockUnlock(base.UserID, SurveyId);
                    Edit = 1;
                }
                else
                {
                    Edit = 2;
                }
  
                Response.Redirect("~/Survey/AddSurvey.aspx?SID=" + SurveyId + "&Edit=" + Edit, true);
  
  
  
            }
            else if (e.CommandName == "UnlockSurvey")
            {
                oReportingCategory = new SurveyQuestionBL();
                GridDataItem item = (GridDataItem)e.Item;
                SurveyId = Convert.ToInt32(item["SurveyTemplateID"].Text);
                dbResult = oReportingCategory.InsertSurveyForLockUnlock(null, SurveyId);
                rgSurvey.Rebind();
  
  
            }
            else if (e.CommandName == "ChangePageSize")
            {
                rgSurvey.PageSize = ((Telerik.Web.UI.GridPageSizeChangedEventArgs)(e)).NewPageSize;
                rgSurvey.Rebind();
            }
        }


Please Provide The Solution ASAP.

Thanks & Regards
Ashish


Ashish
Top achievements
Rank 1
 answered on 31 Aug 2011
4 answers
175 views
I am trying to get the Demo code working in my project with the Grid / Scheduler drag and drop demo and I am getting an error from the java-script function rowDropping. This line is throwing the error:

$get("TargetSlotHiddenField").value = timeSlot.get_index();

The error I get is: "Microsoft JScript runtime error: Unable to set value of the property 'value' : object is null or undefined"

I am not sure what I am missing, I have looked through the demo code several times.

Thanks!
Clark

Plamen
Telerik team
 answered on 31 Aug 2011
1 answer
95 views
avatar

Posted 2 minutes ago (permalink)

I have web application which perfectly works fine when i run through my local asp.net development server , but the problem is none of the radcontrols are responding when i run the same application through IIS7 , can i know what exactly the problem is?, should i make any explicit settings to make radcontrols works fine when run through the IIS7
Slav
Telerik team
 answered on 31 Aug 2011
1 answer
131 views
Hi there

Can anyone point me in the right direction with a problem that has so far stumped me? I have a RadTreeView that uses an .ascx User Control as its node template, and which displays data from a hierarchical data source - the data is a hierarchical set of 'comments' submitted by users for a blog post. All this works fine. The issue is, I am trying to work out the best way of dynamically incorporating into a node an editor control which would be displayed ONLY if a new comment needed to be added as a 'reply' to an existing comment. In other words, I'm looking for a way to only display a text area editor in a node if the 'Reply' button is pressed for a particular node. Obviously I could have a RadEditor hidden within each node template, to be shown only as and when the Reply button is pressed. BUT ... this would mean having a RadEditor control for each and every node in the treeview, and I'm pretty sure this would have rather severe performance implications. I have many many nodes, and dread to think how slow it would be to have a RadEditor control instantiated server-side for each and every node.

At the moment I just have a single RadEditor outside the treeview hierarchy, but this is not ideal as it means the reply text area is at a different place on the page to the comment in question to which the reply is being made. Instead I'm looking for a way to do something like the review pages of Amazon, which appear to re-use a single control at different positions in the comment hierarchy dynamically on demand - I haven't really managed to reverse engineer their technique yet, it seems quite complex, but it appears to involve having a single 'pre-rendered' text area/editor hidden on the page, which is then dynamically injected into the tree view at the correct location by client-side Javascript, using a Placeholder that IS already included in the node template they use (I appreciate they may well not be using the RadTreeView control, but it is something similiar). 

So my question is, are there any additional RadControls that I should be using in order to reproduce this behaviour, or what would be the recommended technique for dynamically re-using and repositioning a single editor control within the tree view hierarchy as a whole, in a way that would avoid having a RadEditor control instantiated for every single node.

Thanks very much for your advice.

Regards



Dimitar Terziev
Telerik team
 answered on 31 Aug 2011
1 answer
226 views
Hi,

I like the scheduler control, I want set the scheduler to full screen (day, week, month, timeline) via javascript, and resize it, and it's should keep full size on it parent div, how implement to this?

Thanks and best regards
Plamen
Telerik team
 answered on 31 Aug 2011
2 answers
529 views
Hi,

I am having a radgrid with template columns containing checkboxes and radcombos . And the last  template column is having a radcombobox control.

On client click of checkboxes, if  checkbox is checked radcombo should be enabled , else it should be disabled.
I want to achieve this functionality by using javascript.
Any suggestions or sample code please help..


Thanks & Regards,
siva prasad.

Jayesh Goyani
Top achievements
Rank 2
 answered on 31 Aug 2011
5 answers
312 views
Hi,

I need to disable some of the toolbar icons(Eg: Bold and Italic) on the RadEditor on button click and i should hide these on clientside .how can i achieve this.


Thanks
Srinivas
Rumen
Telerik team
 answered on 31 Aug 2011
6 answers
423 views
Hi,

 I have a simple problem but have been having a frustrating time figuring this out. I have a html table which has two rows 'trExistingCustomer' and 'trNewCustomer'. I have an edit popup form on the grid. I want to show a certain row and hide the other based on what command the grid is trying to do (Inset / Edit). I use Jquery in a RadCodeBlack to do this, I am firing a function on the ClientEvent OnPopUpShowing. how I can I check if this was triggered from Insert comand or Edit command in the javascript. I already tried using the function onCommand (Please see code) I saw another example and thought this might be the relevant function but this is not working and it displays all rows. Can someone please show an example in code how to check for the calling command in the popup function or onCommand to do this right? Also is there a list of all client side events asscociated with the edit form and the grid somewhere, I think that would be helpful to know. Any help is appreciated
HTML table in Edit popup form in RadGrid
  
   <table id="tblEditPopup" style="width:100%; height:100%">
     <tr id="trExistingCustomer" >
                              <td align="right">
                                 Select Existing Customer:
                              </td>
                              <td>
                                  <telerik:RadComboBox  ID="cboxCustomers" runat="server" AutoPostBack="true" DataSourceID="CustomerObjectDataSource" DataTextField="CustomerName" DataValueField="customer_id"  SelectedValue='<%# Bind("customer_id") %>' >
                                     
                                  </telerik:RadComboBox>
                              </td>
                               <td align="right">
                                 Abbreviation:
                               </td>
                              <td>
                                 <asp:TextBox ID="txtCustAbbreviation" runat="server" Text='<%# Bind("CustomerAbbrev") %>' ></asp:TextBox>
                               </td>
                            </tr>
  
                            <tr id="trNewCustomer" >
                               <td align="right">
                                  Customer Name:
                               </td>
                               <td>
                                 <asp:TextBox ID="txtCustomerName" runat="server" Text='<%# Bind("CustomerName") %>' ></asp:TextBox>
                               </td>
                               <td align="right">
                                 Abbreviation:
                               </td>
                               <td>
                                 <asp:TextBox ID="txtNewAbbreviation" runat="server" Text='<%# Bind("CustomerAbbrev") %>'  ></asp:TextBox>
                               </td>
                            </tr>
  
                             
  
                            <tr>
                               <td align="right">
                                  City:
                               </td>
                               <td>
                                 <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>' ></asp:TextBox>
                               </td>
                               <td align="right">
                                 State:
                               </td>
                               <td>
                                   <telerik:RadComboBox ID="cboxStates" runat="server" DataSourceID="StatesObjectDataSource" DataTextField="description" DataValueField="description" AutoPostBack="false"  SelectedValue='<%# Bind("State") %>'>
                                           
                                   </telerik:RadComboBox>
                               </td>
                            </tr>
  
                            <tr>
                              <td align="center" colspan="4" style="" >
                                 <asp:Button ID="BtnSubmit"  Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'  /> 
                                 <asp:Button ID="BtnCancel" Text="Cancel" runat="server" CausesValidation="false" CommandName="Cancel" />
                              </td>
                            </tr>
                            
                        </table>
  
  
GRID's CLIENT SIDE EVENTS
 <ClientSettings>
                <ClientEvents OnPopUpShowing="PopUpShowing" OnCommand="onCommand"  />
   </ClientSettings>
  
JAVASCRIPT
  
 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
        
       var popUp;
                function PopUpShowing(sender, eventArgs) {
                    popUp = eventArgs.get_popUp();
  
                     //This works when the popup comes up but how can I tell if its called from the Edit or Insert command??
                        $('#trExistingCustomer').css('display', 'block');
                        $('#trNewCustomer').css('display', 'none');
  
                                      
                }
  
        //This seems a more logical place to put this but this does not work , is there another command I should be checking for??
         function onCommand(sender, args) {
  
                    if (args.get_commandName() == "InitInsert")        
                   {
                        $('#trExistingCustomer').css('display', 'block');
                        $('#trNewCustomer').css('display', 'none');
                   
                 
                   else if(args.get_commandName() == "InitEdit") {
                        $('#trExistingCustomer').css('display', 'block');
                        $('#trNewCustomer').css('display', 'none');
                   }
  
   </script>
        </telerik:RadCodeBlock>
Farhan
Top achievements
Rank 1
 answered on 31 Aug 2011
2 answers
140 views
Hello!

I'm having some serious issues with RadComboBox which behaves erratically. The problem is I can't bind the data from ItemDataBound event of the RadGrid to the RadComboBox that is inside the UserControl. I always get errors that there is something wrong with binding even though it should work properly.

Here are the code snippets:

TicketUserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TicketUserControl.ascx.cs"
    Inherits="IDE_Ticketing_System__Telerik_.UserControls.TicketUserControl" %>
<table>
    <tr>
        <td>
            NadreÄ‘eni ticket:
        </td>
        <td colspan="3">
            <telerik:RadComboBox ID="rcbNadredeniTicket" DataTextField="OpisTicketa" DataValueField="idTicket"
                AppendDataBoundItems="true" Text='<%# DataBinder.Eval(Container, "DataItem.idNadredeniTicket") %>'
                runat="server" Width="455px">
            </telerik:RadComboBox>
        </td>
    </tr>
    <tr>
        <td>
            Asset:
        </td>
        <td colspan="3">
            <telerik:RadComboBox ID="rcbAsseti" AppendDataBoundItems="true"
                runat="server" Width="455px">
            </telerik:RadComboBox>
        </td>
    </tr>
    <tr>
        <td>
            Opći prioritet:
        </td>
        <td>
            <asp:TextBox ID="txtOpciPrioritet" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OpciPrioritet") %>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Tip:
        </td>
        <td>
            <telerik:RadComboBox ID="rcbTip" Text='<%# DataBinder.Eval(Container, "DataItem.Tip") %>'
                runat="server">
            </telerik:RadComboBox>
        </td>
    </tr>
    <tr>
        <td>
            Status:
        </td>
        <td>
            <telerik:RadComboBox ID="rcbStatus" Text='<%# DataBinder.Eval(Container, "DataItem.Status") %>'
                runat="server">
            </telerik:RadComboBox>
        </td>
    </tr>
    <tr>
        <td>
            Datum prijave:
        </td>
        <td>
            <asp:TextBox ID="txtDatumPrijave" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.DatumPrijave") %>'></asp:TextBox>
        </td>
        <td>
            Vrsta prijave:
        </td>
        <td>
            <telerik:RadComboBox ID="rcbVrstaPrijave" Text='<%# DataBinder.Eval(Container, "DataItem.VrstaPrijave") %>'
                runat="server">
            </telerik:RadComboBox>
        </td>
    </tr>
    <tr>
        <td>
            Prioritet:
        </td>
        <td>
            <telerik:RadComboBox ID="rcbPrioritet" Text='<%# DataBinder.Eval(Container, "DataItem.Prioritet") %>'
                runat="server">
            </telerik:RadComboBox>
        </td>
        <td>
            Deadline:
        </td>
        <td>
            <asp:TextBox ID="txtDeadline" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.DatumDo") %>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Opis:
        </td>
        <td colspan="3">
            <asp:TextBox ID="txtOpis" runat="server" TextMode="MultiLine" Width="455px" Height="200px"
                Text='<%# DataBinder.Eval(Container, "DataItem.Opis") %>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            Zatvoren ticket:
        </td>
        <td>
            <asp:CheckBox ID="chkZatvoren" runat="server" Checked='<%# CheckNull(DataBinder.Eval(Container, "DataItem.Zatvoren")) %>' />
        </td>
    </tr>
    <tr>
        <td>
            Opis zatvorenog ticketa:
        </td>
        <td colspan="3">
            <asp:TextBox ID="txtOpisZatvorenog" runat="server" TextMode="MultiLine" Width="455px"
                Height="200px" Text='<%# DataBinder.Eval(Container, "DataItem.OpisZatvoren") %>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            <asp:Button ID="btnUpdate" Text="Spremi" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'>
            </asp:Button>
            <asp:Button ID="btnInsert" Text="Spremi" runat="server" CommandName="PerformInsert"
                Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'></asp:Button>
              
            <asp:Button ID="btnCancel" Text="Odustani" runat="server" CausesValidation="False"
                CommandName="Cancel"></asp:Button>
        </td>
    </tr>
</table>

TvrtkaWebForm.aspx (the one with RadGrid)
<telerik:RadGrid ID="gvTicketi" runat="server" AllowPaging="True" AllowSorting="True"
    AutoGenerateColumns="False" CellSpacing="0" GridLines="None"
    onneeddatasource="gvTicketi_NeedDataSource"
    onitemdatabound="gvTicketi_ItemDataBound"
    oninsertcommand="gvTicketi_InsertCommand">
    <MasterTableView DataKeyNames="idTicket" CommandItemDisplay="TopAndBottom" InsertItemPageIndexAction="ShowItemOnCurrentPage">
        <CommandItemSettings AddNewRecordText="Dodaj novi ticket" RefreshText="Prikaži sve tickete" />
        <Columns>
            <telerik:GridBoundColumn UniqueName="idTicket" HeaderText="Ticket" DataField="idTicket">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="idKontakt" HeaderText="Kontakt" DataField="Kontakt">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="idManager" HeaderText="Manager" DataField="idManager">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Opis" HeaderText="Opis" DataField="Opis">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="TicketNumber" HeaderText="Broj ticketa" DataField="TicketNumber">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="DatumPrijave" HeaderText="Datum prijave" DataField="DatumPrijave" DataFormatString="{0:dd.MM.yyyy.}">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="VrstaPrijave" HeaderText="Vrsta prijave" DataField="VrstaPrijave">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Tip" HeaderText="Tip" DataField="Tip">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Status" HeaderText="Status" DataField="Status">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Prioritet" HeaderText="Prioritet" DataField="Prioritet">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="OpciPrioritet" HeaderText="Opći prioritet" DataField="OpciPrioritet">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Deadline" HeaderText="Deadline" DataField="DatumDo" DataFormatString="{0:dd.MM.yyyy.}">
            </telerik:GridBoundColumn>
            <telerik:GridCheckBoxColumn UniqueName="Zatvoren" HeaderText="Zatvoren" DataField="Zatvoren">
            </telerik:GridCheckBoxColumn>
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
            </telerik:GridEditCommandColumn>
            <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete"
                ConfirmDialogType="RadWindow" ConfirmText="Brisanje ticketa!" />
        </Columns>
        <EditFormSettings UserControlName="UserControls/TicketUserControl.ascx" EditFormType="WebUserControl">
            <EditColumn UniqueName="EditCommandColumn1">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

TvrtkaWebForm.aspx.cs:
protected void gvTicketi_ItemDataBound(object sender, GridItemEventArgs e)
{
    int idFirma = Convert.ToInt16(Request.QueryString["idt"]);
 
    if ((e.Item is GridEditFormItem) && e.Item.IsInEditMode )
    {
        GridEditFormItem editFormItem = (GridEditFormItem)e.Item;
        UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
        TSEntities db = new TSEntities();
        Ticket ticket = new Ticket();
 
        RadComboBox rcbTip = (RadComboBox)userControl.FindControl("rcbTip");
        rcbTip.Items.Add(new RadComboBoxItem("Incident"));
        rcbTip.Items.Add(new RadComboBoxItem("Reklamacija"));
        rcbTip.Items.Add(new RadComboBoxItem("Nova funkcionalnost"));
        rcbTip.DataBind();
 
        RadComboBox rcbStatus = (RadComboBox)userControl.FindControl("rcbStatus");
        rcbStatus.Items.Add(new RadComboBoxItem("New"));
        rcbStatus.Items.Add(new RadComboBoxItem("U radu"));
        rcbStatus.Items.Add(new RadComboBoxItem("On hold"));
        rcbStatus.Items.Add(new RadComboBoxItem("Pending"));
        rcbStatus.Items.Add(new RadComboBoxItem("Scheduled"));
        rcbStatus.Items.Add(new RadComboBoxItem("Canceled"));
        rcbStatus.Items.Add(new RadComboBoxItem("Completed"));
        rcbStatus.DataBind();
 
        RadComboBox rcbVrstaPrijave = (RadComboBox)userControl.FindControl("rcbVrstaPrijave");
        rcbVrstaPrijave.Items.Add(new RadComboBoxItem("Usmeno"));
        rcbVrstaPrijave.Items.Add(new RadComboBoxItem("Telefon"));
        rcbVrstaPrijave.Items.Add(new RadComboBoxItem("E-mail"));
        rcbVrstaPrijave.Items.Add(new RadComboBoxItem("Web"));
        rcbVrstaPrijave.DataBind();
 
        RadComboBox rcbPrioritet = (RadComboBox)userControl.FindControl("rcbPrioritet");
        rcbPrioritet.Items.Add(new RadComboBoxItem("Low"));
        rcbPrioritet.Items.Add(new RadComboBoxItem("Normal"));
        rcbPrioritet.Items.Add(new RadComboBoxItem("High"));
        rcbPrioritet.Items.Add(new RadComboBoxItem("Odmah"));
        rcbPrioritet.DataBind();
 
        CheckBox chkNadreden = (CheckBox)userControl.FindControl("chkNadreden");
 
        RadComboBox rcbNadredeniTicket = (RadComboBox)userControl.FindControl("rcbNadredeniTicket");
        var nadredenTicketList = (from t in db.Ticket
                                    select t).ToList();
 
        rcbNadredeniTicket.DataSource = from t in nadredenTicketList
                                        where t.idFirma == idFirma && t.Zatvoren == false
                                        select new { t.idTicket, OpisTicketa = t.idTicket + " - " + t.Opis };
 
        rcbNadredeniTicket.Items.Add(new RadComboBoxItem("Bez nadreÄ‘enog ticketa", "0"));
        rcbNadredeniTicket.DataBind();
 
        RadComboBox rcbAsset = (RadComboBox)userControl.FindControl("rcbAsset");
        var ticketAssetList = (from a in db.Asset
                               where a.idFirma == idFirma
                               select a).ToList();
 
        if (ticketAssetList.Count > 0)
        {
            var assets = from a in db.Asset
                         where a.idFirma == idFirma
                         select new { a.idAsset, a.Naziv };
 
            rcbAsset.DataSource = assets;
            rcbAsset.DataTextField = "Naziv";
            rcbAsset.DataValueField = "idAsset";
            rcbAsset.Text = "'<%# DataBinder.Eval(Container, 'DataItem.Naziv') %>'";
            rcbAsset.DataBind();
        }                            
         
         
        if (!e.Item.OwnerTableView.IsItemInserted)
        {
            int idTicket = Convert.ToInt32(editFormItem.GetDataKeyValue("idTicket"));
            ticket = db.Ticket.SingleOrDefault(t => t.idTicket == idTicket);
 
            string tip = ticket.Tip;
            rcbTip.Items.FindItemByText(tip).Selected = true;
 
            string status = ticket.Status;
            rcbStatus.Items.FindItemByText(status).Selected = true;
 
            string vrstaPrijave = ticket.VrstaPrijave;
            rcbVrstaPrijave.Items.FindItemByText(vrstaPrijave).Selected = true;
 
            string prioritet = ticket.Prioritet;
            rcbPrioritet.Items.FindItemByText(prioritet).Selected = true;
             
        }              
    }
}

The problem occurs in the line with RadComboBox rcbAsset. The problem is a bit urgent so any help would be appreciated!
Ignjat
Top achievements
Rank 1
 answered on 31 Aug 2011
5 answers
115 views
Hi,
I have a scheduler that is initially hidden on my page.  After the user hits a button the data should be populated.

Technically it works fine and the data is shown BUT on the first load the height of the scheduler is normally set to about 108px.  I've hardcoded the height to be 550px and that doesn't fix this.  

Interestingly if I resize the page, reload the page, visit another page and then come back the problem doesn't reappear until the tab is closed and a new tab opened. This seems to be affecting all browsers but is most demonstrable in chrome and is easy to replicate in chrome.

Tomorrow I'll be creating a demo to solve this, in the meantime is there any obvious reason why this might be happening?

Regards,

Jon

Plamen
Telerik team
 answered on 31 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?