Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
313 views
Hello!

First time poster here. Very interested in this product but am trying the trial version until I am satisfied. I am following the tutorial and putting multipage inside the radtabstrips to display pages properly. The issue I am having is that when I align the the tabstrips differently it doesn't display properly, if I add a border it only includes the tabs and not the individual page views.. its like they aren't even attached even the tabs properly display the right page views... heres my code:

asp.net:

<telerik:RadTabStrip ID="RadTabStrip1" runat="server" Align="Justify" Orientation="VerticalLeft" MultiPageID="RadMultiPagePatRecords">
        <Tabs>
            <telerik:RadTab runat="server" Text="Patient Search">
            </telerik:RadTab>
            <telerik:RadTab runat="server" Text="Delinquent Accounts">
            </telerik:RadTab>
            <telerik:RadTab runat="server" Text="Invoices">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPagePatRecords" runat="server">
        <telerik:RadPageView ID="RadPatientSearch" runat="server">
            <table>
                <tr>
                    <td class="labels" align="center">
                        <asp:Label ID="Label1" runat="server" Text="First Name: "></asp:Label>
                    </td>
                    <td class="textboxes">
                        <telerik:RadTextBox ID="txtFirstName" runat="server" EmptyMessage="Type Here" Width="100%">
                        </telerik:RadTextBox>
                    </td>
                    <td class="labels" align="center">
                        <asp:Label ID="Label2" runat="server" Text="Last Name:"></asp:Label>
                    </td>
                    <td class="textboxes">
                        <telerik:RadTextBox ID="txtLastName" runat="server" EmptyMessage="Type Here" Width="100%">
                        </telerik:RadTextBox>
                    </td>
                    <td class="labels" align="center">
                        <asp:Label ID="Label3" runat="server" Text="DOB:"></asp:Label>
                    </td>
                    <td class="textboxsmall">
                        <telerik:RadDateInput ID="RadDateInput1" runat="server" DateFormat="MM/dd/yyyy"
                            EmptyMessage="(MM/dd/yyyy)" Width="100%">
                            <EmptyMessageStyle Font-Size="Smaller" />
                        </telerik:RadDateInput>
                    </td>
                </tr>
            </table>
        </telerik:RadPageView>
    </telerik:RadMultiPage>



this is how its displaying: http://screencast.com/t/EFY9EVoD

what am i doing wrong? thanks for the help! really loving the tools so far! :)
Ekjot
Top achievements
Rank 1
 answered on 03 Jan 2012
3 answers
163 views
Hello!

I'm having some problems with RadGrid control. I added couple of controls (mostly TextBoxes and DropDownLists) so I could filter the RadGrid records. Filtering works fine, but whenever I try to Edit or Delete the row RadGrid picks the wrong record and I'm clueless about what to do to fix it.

Here is the .aspx part of the page:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div class="fieldset">
                <fieldset>
                    <legend>Tvrtka</legend>
                    <telerik:RadComboBox ID="rcbTvrtka" runat="server" AppendDataBoundItems="true" Skin="Hay">
                    </telerik:RadComboBox>
                </fieldset>
            </div>
            <div class="fieldset">
                <fieldset>
                    <legend>Tip usera</legend>
                    <telerik:RadComboBox ID="rcbTipUsera" runat="server" AppendDataBoundItems="true"
                        Skin="Hay">
                    </telerik:RadComboBox>
                </fieldset>
            </div>
            <div class="fieldset3">
                <fieldset>
                    <legend>Aktivan</legend>
                    <asp:CheckBox ID="chkAktivan" runat="server" />
                </fieldset>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnReset" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <div class="fieldset3">
        <fieldset>
            <legend>Pretraga</legend>
            <asp:Button ID="btnSearch" runat="server" Text="Traži" OnClick="btnSearch_Click" />
        </fieldset>
    </div>
    <div class="fieldset3">
        <fieldset>
            <legend>Reset</legend>
            <asp:Button ID="btnReset" runat="server" Text="Resetiraj" OnClick="btnReset_Click" />
        </fieldset>
    </div>
    <telerik:RadGrid ID="gvKontakti" runat="server" AllowPaging="True" AllowSorting="True"
        PageSize="25" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" OnNeedDataSource="gvKontakti_NeedDataSource"
        AllowFilteringByColumn="False" Skin="Hay" OnItemDataBound="gvKontakti_ItemDataBound"
        OnPreRender="gvKontakti_PreRender" OnUpdateCommand="gvKontakti_UpdateCommand"
        OnDetailTableDataBind="gvKontakti_DetailTableDataBind" OnInsertCommand="gvKontakti_InsertCommand"
        OnItemCommand="gvKontakti_ItemCommand">
        <MasterTableView DataKeyNames="idKontakt" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage"
            TableLayout="Fixed" Caption="Kontakti">
            <DetailTables>
                <telerik:GridTableView Name="Assets" Width="100%" CommandItemDisplay="None" Caption="Asseti">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="idKontakt" MasterKeyField="idKontakt" />
                    </ParentTableRelation>
                    <CommandItemSettings AddNewRecordText="Dodaj novi item" ShowAddNewRecordButton="true" />
                    <Columns>
                        <telerik:GridBoundColumn UniqueName="Naziv" DataField="NazivAsseta" HeaderText="Naziv"
                            HeaderStyle-Width="200px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="DatumGarancije" HeaderText="Datum garancije"
                            DataField="DatumGarancije" DataFormatString="{0:dd.MM.yyyy.}" HeaderStyle-Width="100px">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <EditFormSettings UserControlName="UserControls/TicketAssetUserControl.ascx" EditFormType="WebUserControl">
                        <EditColumn UniqueName="EditCommandColumnItem1">
                        </EditColumn>
                    </EditFormSettings>
                </telerik:GridTableView>
            </DetailTables>
            <DetailTables>
                <telerik:GridTableView DataKeyNames="idTicket" Name="Tickets" CommandItemDisplay="None"
                    Caption="Incidenti">
                    <Columns>
                        <telerik:GridBoundColumn UniqueName="TicketNumber" HeaderText="Broj incidenta" DataField="TicketNumber"
                            HeaderStyle-Width="70px">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="DatumPrijave" HeaderText="Datum prijave" UniqueName="DatumPrijave"
                            PickerType="DatePicker" DataFormatString="{0:dd.MM.yyyy.}" HeaderStyle-Width="80px">
                        </telerik:GridDateTimeColumn>
                        <telerik:GridTemplateColumn UniqueName="Opis" HeaderText="Opis" DataField="Opis"
                            HeaderStyle-Width="400px">
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Opis") %>'>
                                </asp:Label>
                                <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="Label1" Width="150px"
                                    RelativeTo="Element" Position="MiddleRight" EnableShadow="false">
                                    <%# DataBinder.Eval(Container, "DataItem.Biljeske") %>
                                </telerik:RadToolTip>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn UniqueName="Status" HeaderText="Status" DataField="Status"
                            HeaderStyle-Width="80px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="Prioritet" HeaderText="Prioritet" DataField="Prioritet"
                            HeaderStyle-Width="70px">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="DatumDo" HeaderText="Deadline" UniqueName="Deadline"
                            PickerType="DatePicker" DataFormatString="{0:dd.MM.yyyy.}" HeaderStyle-Width="80px">
                        </telerik:GridDateTimeColumn>
                        <telerik:GridBoundColumn UniqueName="Tip" HeaderText="Tip" DataField="Tip" HeaderStyle-Width="80px">
                        </telerik:GridBoundColumn>
                        <telerik:GridCheckBoxColumn UniqueName="Naplacen" HeaderText="Naplaćen" DataField="IzdanRacun"
                            HeaderStyle-Width="65px">
                        </telerik:GridCheckBoxColumn>
                        <telerik:GridCheckBoxColumn UniqueName="Zatvoren" HeaderText="Zatvoren" DataField="Zatvoren"
                            HeaderStyle-Width="60px">
                        </telerik:GridCheckBoxColumn>
                        <telerik:GridBoundColumn UniqueName="DailySum" HeaderText="Efektivno vrijeme" DataField="DailySum"
                            HeaderStyle-Width="70px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="DailyCount" HeaderText="Broj dolazaka" DataField="DailyCount"
                            HeaderStyle-Width="70px">
                        </telerik:GridBoundColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <CommandItemSettings ShowAddNewRecordButton="true" AddNewRecordText="Dodaj novi kontakt" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" EditText="Detalji"
                    HeaderStyle-Width="50px">
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn UniqueName="Kontakt" DataField="Naziv" HeaderText="Kontakt"
                    HeaderStyle-Width="150px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Tvrtka" HeaderText="Tvrtka" DataField="Tvrtka"
                    HeaderStyle-Width="150px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Funkcija" HeaderText="Funkcija" DataField="Funkcija"
                    HeaderStyle-Width="150px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Tel1" HeaderText="Telefon 1" DataField="Tel1"
                    HeaderStyle-Width="100px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Tel2" HeaderText="Telefon 2" DataField="Tel2"
                    HeaderStyle-Width="100px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Mob1" HeaderText="Mobitel 1" DataField="Mob1"
                    HeaderStyle-Width="100px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Mob2" HeaderText="Mobitel 2" DataField="Mob2"
                    HeaderStyle-Width="100px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Email1" HeaderText="E-mail 1" DataField="Email1"
                    HeaderStyle-Width="100px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Adresa1" HeaderText="Adresa 1" DataField="Adresa1"
                    HeaderStyle-Width="150px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Grad" HeaderText="Grad" DataField="Grad" HeaderStyle-Width="100px">
                </telerik:GridBoundColumn>
                <telerik:GridCheckBoxColumn UniqueName="Aktivan" HeaderText="Aktivan" DataField="Aktivan"
                    HeaderStyle-Width="80px">
                </telerik:GridCheckBoxColumn>
                <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete"
                    ConfirmDialogType="RadWindow" ConfirmText="Brisanjem kontakta briÅ¡u se i svi asseti!"
                    HeaderStyle-Width="50px">
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings UserControlName="UserControls/KontaktUserControl.ascx" EditFormType="WebUserControl">
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Hay">
        </HeaderContextMenu>
    </telerik:RadGrid>
</asp:Content>

Here is the .aspx.cs part of the page:
TSEntities db = new TSEntities();
 
protected void Page_Load(object sender, EventArgs e)
{
    int idAuthenticatedUser = Convert.ToInt32(Session["authenticatedUI"]);
 
    Kontakt kontakt = new Kontakt();
    kontakt = db.Kontakt.SingleOrDefault(k => k.idKontakt == idAuthenticatedUser);
 
    if (Session["authenticatedUI"] == null)
    {
        Response.Redirect("Login.aspx");
    }
    else if (kontakt.idOvlasti == 3 || kontakt.idOvlasti == 4)
    {
        if (Request.RawUrl != "/KontaktiWebForm.aspx?idk=" + idAuthenticatedUser)
        {
            Response.Redirect("KontaktiWebForm.aspx?idk=" + idAuthenticatedUser);
        }
    }
 
    if (!IsPostBack)
    {
        Populate();
        chkAktivan.Checked = true;
    }
}
 
protected void Populate()
{
    var tvrtkaList = (from t in db.Firma
                      select t).ToList();
 
    var tvrtka = from t in tvrtkaList
                 orderby t.Naziv
                 select new { t.idFirma, t.Naziv };
 
    rcbTvrtka.Items.Clear();
    rcbTvrtka.Items.Add(new RadComboBoxItem("Odaberi tvrtku", "0"));
    rcbTvrtka.DataSource = tvrtka;
    rcbTvrtka.DataTextField = "Naziv";
    rcbTvrtka.DataValueField = "idFirma";
    rcbTvrtka.DataBind();
 
    var userType = from u in db.Ovlasti
                   select new { u.idOvlasti, u.Naziv };
 
    rcbTipUsera.Items.Add(new RadComboBoxItem("Odaberi tip", "0"));
    rcbTipUsera.DataSource = userType;
    rcbTipUsera.DataTextField = "Naziv";
    rcbTipUsera.DataValueField = "idOvlasti";
    rcbTipUsera.DataBind();
 
}
 
protected void gvKontakti_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    int idKontakt = Convert.ToInt32(Request.QueryString["idk"]);
    int idAuthKontakt = Convert.ToInt32(Session["authenticatedUI"]);
 
    if (idKontakt > 0 && idAuthKontakt == idKontakt)
    {
        gvKontakti.DataSource = from k in db.Kontakt
                                where k.idKontakt == idKontakt && k.Aktivan == true
                                orderby k.Prezime, k.Ime
                                select new { Tvrtka = k.Firma.Naziv, k.idKontakt, Naziv = k.Ime + " " + k.Prezime, Funkcija = k.Funkcija, k.Ime, k.Prezime, k.Tel1, k.Tel2, k.Mob1, k.Mob2, k.Email1, k.Email2, k.Fax, k.Adresa1, k.Adresa2, k.Adresa3, k.Grad, k.PostanskiBroj, k.Drzava, k.Biljeske, k.Aktivan, k.Username, k.Password };
    }
    else if (idKontakt > 0 && idAuthKontakt != idKontakt)
    {
      gvKontakti.DataSource = from k in db.Kontakt
                              where k.idKontakt == idKontakt && k.Aktivan == true
                                orderby k.Prezime, k.Ime
                                select new { Tvrtka = k.Firma.Naziv, k.idKontakt, Naziv = k.Ime + " " + k.Prezime, Funkcija = k.Funkcija, k.Ime, k.Prezime, k.Tel1, k.Tel2, k.Mob1, k.Mob2, k.Email1, k.Email2, k.Fax, k.Adresa1, k.Adresa2, k.Adresa3, k.Grad, k.PostanskiBroj, k.Drzava, k.Biljeske, k.Aktivan, k.Username, k.Password };
    }
    else
    {
        gvKontakti.DataSource = from k in db.Kontakt
                                where k.Aktivan == true
                                orderby k.Prezime, k.Ime
                                select new { Tvrtka = k.Firma.Naziv, k.idKontakt, Naziv = k.Ime + " " + k.Prezime, Funkcija = k.Funkcija, k.Ime, k.Prezime, k.Tel1, k.Tel2, k.Mob1, k.Mob2, k.Email1, k.Email2, k.Fax, k.Adresa1, k.Adresa2, k.Adresa3, k.Grad, k.PostanskiBroj, k.Drzava, k.Biljeske, k.Aktivan, k.Username, k.Password };
    }
}
 
protected void gvKontakti_ItemDataBound(object sender, GridItemEventArgs e)
{
    int idKontakt = Convert.ToInt32(Request.QueryString["idk"]);
    int idAuthKontakt = Convert.ToInt32(Session["authenticatedUI"]);
 
    if ((e.Item is GridEditFormItem) && e.Item.IsInEditMode)
    {
        UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
        GridEditFormItem editFormItem = (GridEditFormItem)e.Item;
 
        Button btnUpdate = (Button)userControl.FindControl("btnUpdate");
        TextBox txtUsername = (TextBox)userControl.FindControl("txtUsername");
        TextBox txtPassword = (TextBox)userControl.FindControl("txtPassword");
        RadComboBox rcbTvrtka = (RadComboBox)userControl.FindControl("rcbTvrtka");
        RadComboBox rcbOvlasti = (RadComboBox)userControl.FindControl("rcbOvlasti");
 
        Kontakt authKontakt = new Kontakt();
        authKontakt = db.Kontakt.SingleOrDefault(k => k.idKontakt == idAuthKontakt);
 
        var tvrtkeList = (from t in db.Firma
                          orderby t.Naziv
                          select t).ToList();
 
        rcbTvrtka.DataSource = from t in tvrtkeList
                               select new { t.idFirma, t.Naziv };
 
        rcbTvrtka.DataTextField = "Naziv";
        rcbTvrtka.DataValueField = "idFirma";
        rcbTvrtka.Text = "'<%# DataBinder.Eval(Container, 'DataItem.idFirma') %>'";
        rcbTvrtka.DataBind();
 
        rcbOvlasti.DataSource = from o in db.Ovlasti
                                select o;
 
        rcbOvlasti.DataTextField = "Naziv";
        rcbOvlasti.DataValueField = "idOvlasti";
        rcbOvlasti.Text = "'<%# DataBinder.Eval(Container, 'DataItem.idOvlasti') %>'";
        rcbOvlasti.DataBind();
 
        rcbOvlasti.Items.FindItemByValue("4").Selected = true;
 
        if (authKontakt.idOvlasti == 4 || authKontakt.idOvlasti == 3 || authKontakt.idOvlasti == 2)
        {
            rcbOvlasti.Enabled = false;
        }
 
        if (authKontakt.idOvlasti == 4 || authKontakt.idOvlasti == 3)
        {
            rcbTvrtka.Enabled = false;
        }
 
        txtUsername.ReadOnly = false;
        txtPassword.ReadOnly = false;
 
        if (!e.Item.OwnerTableView.IsItemInserted)
        {
            Kontakt kontakt = new Kontakt();
 
            int idKontaktSelected = Convert.ToInt32(editFormItem.GetDataKeyValue("idKontakt"));
 
            kontakt = db.Kontakt.SingleOrDefault(k => k.idKontakt == idKontaktSelected);
 
            if (idKontaktSelected == idAuthKontakt || authKontakt.idOvlasti == 2 || authKontakt.idOvlasti == 1)
            {
                txtUsername.ReadOnly = false;
                txtPassword.ReadOnly = false;
                btnUpdate.Visible = true;
            }
            else
            {
                txtUsername.ReadOnly = true;
                txtPassword.ReadOnly = true;
                btnUpdate.Visible = false;
            }
 
            int idTvrtka = Convert.ToInt16(kontakt.idFirma);
            rcbTvrtka.Items.FindItemByValue(idTvrtka.ToString()).Selected = true;
            Session["rcbTvrtka"] = idTvrtka;
 
            rcbOvlasti.Items.FindItemByValue(kontakt.idOvlasti.ToString()).Selected = true;
             
            CheckBox chkAktivan = (CheckBox)userControl.FindControl("chkAktivan");
 
            if (kontakt.Aktivan == true)
            {
                chkAktivan.Checked = true;
            }
            else
            {
                chkAktivan.Checked = false;
            }
        }
    }
 
}
 
protected void gvKontakti_PreRender(object sender, EventArgs e)
{
    int idKontakt = Convert.ToInt32(Request.QueryString["idk"]);
 
    if (!this.IsPostBack && idKontakt > 0)
    {
        this.gvKontakti.MasterTableView.Items[0].Edit = true;
        this.gvKontakti.MasterTableView.Rebind();
    }
}
 
protected void gvKontakti_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem editedItem = e.Item as GridEditableItem;
    UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
    RadComboBox rcbOvlasti = (RadComboBox)userControl.FindControl("rcbOvlasti");
    RadComboBox rcbTvrtka = (RadComboBox)userControl.FindControl("rcbTvrtka");
 
    int idKontakt = Convert.ToInt32(editedItem.GetDataKeyValue("idKontakt"));
 
    Kontakt kontakt = new Kontakt();
    kontakt = db.Kontakt.SingleOrDefault(k => k.idKontakt == idKontakt);
 
    int idFirma = Convert.ToInt32(rcbTvrtka.SelectedItem.Value);
 
    kontakt.idFirma = Convert.ToInt32(rcbTvrtka.SelectedItem.Value);
    kontakt.Ime = (userControl.FindControl("txtIme") as TextBox).Text;
    kontakt.Prezime = (userControl.FindControl("txtPrezime") as TextBox).Text;
    kontakt.Adresa1 = (userControl.FindControl("txtAdresa1") as TextBox).Text;
    kontakt.Adresa2 = (userControl.FindControl("txtAdresa2") as TextBox).Text;
    kontakt.Adresa3 = (userControl.FindControl("txtAdresa3") as TextBox).Text;
    kontakt.Biljeske = (userControl.FindControl("txtBiljeske") as TextBox).Text;
    kontakt.Funkcija = (userControl.FindControl("txtFunkcija") as TextBox).Text;
    kontakt.Prezime = (userControl.FindControl("txtPrezime") as TextBox).Text;
    kontakt.Grad = (userControl.FindControl("txtGrad") as TextBox).Text;
    kontakt.Drzava = (userControl.FindControl("txtDrzava") as TextBox).Text;
    kontakt.PostanskiBroj = (userControl.FindControl("txtPBR") as TextBox).Text;
    kontakt.Mob1 = (userControl.FindControl("txtMob1") as TextBox).Text;
    kontakt.Mob2 = (userControl.FindControl("txtMob2") as TextBox).Text;
    kontakt.Tel1 = (userControl.FindControl("txtTel1") as TextBox).Text;
    kontakt.Tel2 = (userControl.FindControl("txtTel2") as TextBox).Text;
    kontakt.Fax = (userControl.FindControl("txtFax") as TextBox).Text;
    kontakt.Email1 = (userControl.FindControl("txtEmail1") as TextBox).Text;
    kontakt.Email2 = (userControl.FindControl("txtEmail2") as TextBox).Text;
    kontakt.Aktivan = (userControl.FindControl("chkAktivan") as CheckBox).Checked;
    kontakt.idOvlasti = Convert.ToInt32(rcbOvlasti.SelectedItem.Value);
     
    kontakt.Username = (userControl.FindControl("txtUsername") as TextBox).Text;
 
    string password = (userControl.FindControl("txtPassword") as TextBox).Text;
    string passwordHash = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
 
    if (password.Length > 0)
    {
        kontakt.Password = passwordHash;
    }
               
    db.SaveChanges();
}
 
protected void gvKontakti_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
{
    GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
 
    int idKontakt = Convert.ToInt16(dataItem.GetDataKeyValue("idKontakt"));
 
    switch (e.DetailTableView.Name)
    {
                                     
        case "Assets":
            {
                e.DetailTableView.DataSource = from a in db.Asset
                                               where a.idKontakt == idKontakt && a.Aktivan == true
                                               select new {a.idKontakt, NazivAsseta =  a.Naziv, a.DatumGarancije };
            }
            break;
 
        case "Tickets":
            {
                var ticketList = (from t in db.Ticket
                                  where t.idKontakt == idKontakt && t.Zatvoren == false
                                  select t).ToList();
 
                e.DetailTableView.DataSource = from t in ticketList
                                               where t.Zatvoren == false
                                               orderby t.idTicket, t.RedniBroj, t.DatumPrijave
                                               select new
                                               {
                                                   t.idTicket,
                                                   t.idFirma,
                                                   t.idKontakt,
                                                   t.idManager,
                                                   t.idNadredeniTicket,
                                                   TicketNumber = t.idNadredeniTicket + "-" + t.RedniBroj,
                                                   t.Biljeske,
                                                   t.DatumDo,
                                                   t.DatumPrijave,
                                                   t.OpciPrioritet,
                                                   t.Opis,
                                                   t.OpisZatvoren,
                                                   t.Prioritet,
                                                   t.Status,
                                                   t.Tip,
                                                   t.VrstaPrijave,
                                                   t.Zatvoren,
                                                   NazivKontakta = t.Kontakt == null ? "Bez kontakta" : t.Kontakt.Ime + " " + t.Kontakt.Prezime
                                               };
            }
            break;
                 
    }
}
 
protected void gvKontakti_InsertCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem editedItem = e.Item as GridEditableItem;
    UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
    TSEntities db = new TSEntities();
    Kontakt kontakt = new Kontakt();
 
    RadComboBox rcbTvrtka = (RadComboBox)userControl.FindControl("rcbTvrtka");
    RadComboBox rcbOvlasti = (RadComboBox)userControl.FindControl("rcbOvlasti");
 
    kontakt.idFirma = Convert.ToInt32(rcbTvrtka.SelectedItem.Value);
    kontakt.Ime = (userControl.FindControl("txtIme") as TextBox).Text;
    kontakt.Prezime = (userControl.FindControl("txtPrezime") as TextBox).Text;
    kontakt.Adresa1 = (userControl.FindControl("txtAdresa1") as TextBox).Text;
    kontakt.Adresa2 = (userControl.FindControl("txtAdresa2") as TextBox).Text;
    kontakt.Adresa3 = (userControl.FindControl("txtAdresa3") as TextBox).Text;
    kontakt.Biljeske = (userControl.FindControl("txtBiljeske") as TextBox).Text;
    kontakt.Funkcija = (userControl.FindControl("txtFunkcija") as TextBox).Text;
    kontakt.Prezime = (userControl.FindControl("txtPrezime") as TextBox).Text;
    kontakt.Grad = (userControl.FindControl("txtGrad") as TextBox).Text;
    kontakt.Drzava = (userControl.FindControl("txtDrzava") as TextBox).Text;
    kontakt.PostanskiBroj = (userControl.FindControl("txtPBR") as TextBox).Text;
    kontakt.Mob1 = (userControl.FindControl("txtMob1") as TextBox).Text;
    kontakt.Mob2 = (userControl.FindControl("txtMob2") as TextBox).Text;
    kontakt.Tel1 = (userControl.FindControl("txtTel1") as TextBox).Text;
    kontakt.Tel2 = (userControl.FindControl("txtTel2") as TextBox).Text;
    kontakt.Fax = (userControl.FindControl("txtFax") as TextBox).Text;
    kontakt.Email1 = (userControl.FindControl("txtEmail1") as TextBox).Text;
    kontakt.Email2 = (userControl.FindControl("txtEmail2") as TextBox).Text;
    kontakt.Aktivan = (userControl.FindControl("chkAktivan") as CheckBox).Checked;
    kontakt.idOvlasti = Convert.ToInt32(rcbOvlasti.SelectedItem.Value);
 
    kontakt.Username = (userControl.FindControl("txtUsername") as TextBox).Text;
 
    string passwordHash = FormsAuthentication.HashPasswordForStoringInConfigFile((userControl.FindControl("txtPassword") as TextBox).Text, "MD5");
    kontakt.Password = passwordHash;
 
    db.AddToKontakt(kontakt);
    db.SaveChanges();
 
}
 
protected void btnSearch_Click(object sender, EventArgs e)
{
    var kontakti = from k in db.Kontakt
                   select k;
 
    int idTipUsera = Convert.ToInt32(rcbTipUsera.SelectedValue);
    int idTvrtka = Convert.ToInt32(rcbTvrtka.SelectedValue);
 
    if (rcbTvrtka.SelectedValue != "0")
    {
        kontakti = kontakti.Where(k => k.idFirma == idTvrtka);
    }
 
    if (rcbTipUsera.SelectedValue != "0")
    {
        kontakti = kontakti.Where(k => k.idOvlasti == idTipUsera);
    }
 
    if (chkAktivan.Checked == true)
    {
        kontakti = kontakti.Where(k => k.Aktivan == true);
    }
    else
    {
        kontakti = kontakti.Where(k => k.Aktivan == false);
    }
 
 
    int idKontakt = Convert.ToInt32(Request.QueryString["idk"]);
    int idAuthKontakt = Convert.ToInt32(Session["authenticatedUI"]);
 
    if (idKontakt > 0 && idAuthKontakt == idKontakt)
    {
        gvKontakti.DataSource = from k in kontakti
                                where k.idKontakt == idKontakt
                                orderby k.Prezime, k.Ime
                                select new { Tvrtka = k.Firma.Naziv, k.idKontakt, Naziv = k.Ime + " " + k.Prezime, Funkcija = k.Funkcija, k.Ime, k.Prezime, k.Tel1, k.Tel2, k.Mob1, k.Mob2, k.Email1, k.Email2, k.Fax, k.Adresa1, k.Adresa2, k.Adresa3, k.Grad, k.PostanskiBroj, k.Drzava, k.Biljeske, k.Aktivan, k.Username, k.Password };
    }
    else if (idKontakt > 0 && idAuthKontakt != idKontakt)
    {
        gvKontakti.DataSource = from k in kontakti
                                where k.idKontakt == idKontakt
                                orderby k.Prezime, k.Ime
                                select new { Tvrtka = k.Firma.Naziv, k.idKontakt, Naziv = k.Ime + " " + k.Prezime, Funkcija = k.Funkcija, k.Ime, k.Prezime, k.Tel1, k.Tel2, k.Mob1, k.Mob2, k.Email1, k.Email2, k.Fax, k.Adresa1, k.Adresa2, k.Adresa3, k.Grad, k.PostanskiBroj, k.Drzava, k.Biljeske, k.Aktivan, k.Username, k.Password };
    }
    else
    {
        gvKontakti.DataSource = from k in kontakti
                                orderby k.Prezime, k.Ime
                                select new { Tvrtka = k.Firma.Naziv, k.idKontakt, Naziv = k.Ime + " " + k.Prezime, Funkcija = k.Funkcija, k.Ime, k.Prezime, k.Tel1, k.Tel2, k.Mob1, k.Mob2, k.Email1, k.Email2, k.Fax, k.Adresa1, k.Adresa2, k.Adresa3, k.Grad, k.PostanskiBroj, k.Drzava, k.Biljeske, k.Aktivan, k.Username, k.Password };
    }
 
    gvKontakti.DataBind();
}
 
protected void gvKontakti_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "Delete")
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        int idKontakt = Convert.ToInt32(editedItem.GetDataKeyValue("idKontakt"));
 
        var assets = from a in db.Asset
                     where a.idKontakt == idKontakt
                     select a;
 
        Kontakt kontakt = db.Kontakt.SingleOrDefault(k => k.idKontakt == idKontakt);
        int assetCount = db.Asset.Count(a => a.idKontakt == idKontakt);
 
        if (assetCount != 0)
        {
            foreach (var asset in assets)
            {
                db.DeleteObject(asset);
            }
        }
 
        db.DeleteObject(kontakt);
        db.SaveChanges();
    }
}
 
protected void btnReset_Click(object sender, EventArgs e)
{
    rcbTipUsera.Items.FindItemByValue("0").Selected = true;
    rcbTvrtka.Items.FindItemByValue("0").Selected = true;
    chkAktivan.Checked = true;
 
    gvKontakti.Rebind();
}

I apologize for the size of code posted but I think it could be useful to understand my problem better.

Thank you!

Regards,

Hrvoje
Hrvach
Top achievements
Rank 1
 answered on 03 Jan 2012
1 answer
134 views
Hi Telerik Team,

I have used RadMenu in my application with the following code...

<telerik:RadMenu ID="RadMenu1" runat="server" EnableRootItemScroll="true" Width="80%" Height="5%" style="margin-bottom:100px" 
   EnableRoundedCorners="true" EnableShadows="true" EnableAutoScroll="true" CollapseDelay="100"
    ExpandAnimation-Type="OutBounce" Flow="Horizontal">

 <Items>
                <telerik:RadMenuItem  GroupSettings-Height="100px" ImageUrl="../images/n1.jpg">
                    <Items>
                        <telerik:RadMenuItem Text="New" />
                        <telerik:RadMenuItem Text="Open" />
                        <telerik:RadMenuItem IsSeparator="True" />
                    </Items>
                </telerik:RadMenuItem>
                <telerik:RadMenuItem  GroupSettings-Height="100px" ImageUrl="../images/n2.jpg">
                    <Items>
                        <telerik:RadMenuItem Text="Undo" />
                        <telerik:RadMenuItem IsSeparator="True" />
                        <telerik:RadMenuItem Text="Cut" />
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenuItem>

 </Items>
     </telerik:RadMenu>

The Main Problem is the Images in the RadMenu is not Scrolling Automatically even adding the property called [EnableAutoScroll="true"]. It should scroll from left to right direction with some duration.
And the second thing is how to customise the right and left buttons, means setting these buttons exactly in the middle. and add images to them,
Please Help me out from this problem.....

Thanks...




Kate
Telerik team
 answered on 03 Jan 2012
1 answer
94 views
I have a .NET page that has a RadRotator on it, displaying a series of images.  I also have a "Refresh" button that, when pressed, uses a RadAjaxManager to look for more images to display, and if found, adds them to the RadRotator.  This all works beautifully.

However, I have a second component that is causing issues.  My RadRotator has a "Previous" and "Next" button that I control from code.  When these buttons are pressed they trigger the RadRotator to rotate, and then display a brief text explanation of the current image elsewhere on the page.  Both of these actions are achieved through Javascript: the rotator using the Client-Side API, and the text using an .innerHtml replace on an asp:Label.  The actual text comes from a Javascript array that I set the contents of using a <%= %> code block on page load.

Here's the problem: I can't get RadAjaxManager to update the code block so that the javascript array contains an updated list of text explanations at the same time that more images are bound to the RadRotator.

Possible Solutions:
1.  Find some way to get RadAjaxManager to re-evaluate a block of javascript code containing an ASP.NET code block (Preferred)
2.  Move the array of text explanations out of javascript and into some variable in the code-behind, then trigger a partial callback ever time the Previous/Next buttons are clicked to access it (Not preferable, because the Javascript solutions never has to contact the server)

I tried setting the RadAjaxManager to target the RadCodeBlock that my Javascript is contained in to see if that would work, no luck with that.

Any insight is appreciated, and have a happy New Year!
Mira
Telerik team
 answered on 03 Jan 2012
1 answer
118 views
Sir;

I am using telerik grid control. and i want to add grid on click of button. and then drag and drop rows from other grid controls on page to dynamically created grid control.

whenever i add grid dynamically and try to drag and drop i got this error.
Can u please suggest why this problem is coming.

Thanks and regards
raman singla

Script controls may not be registered after PreRender.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Script controls may not be registered after PreRender.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Script controls may not be registered after PreRender.]
   System.Web.UI.ScriptControlManager.RegisterScriptControl(TScriptControl scriptControl) +432555
   System.Web.UI.ScriptManager.RegisterScriptControl(TScriptControl scriptControl) +92
   Telerik.Web.UI.RadCompositeDataBoundControl.RegisterScriptControl() +72
   Telerik.Web.UI.RadCompositeDataBoundControl.ControlPreRender() +33
   Telerik.Web.UI.RadGrid.ControlPreRender() +118
   Telerik.Web.UI.RadCompositeDataBoundControl.OnPreRender(EventArgs e) +47
   System.Web.UI.Control.PreRenderRecursiveInternal() +103
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
Mira
Telerik team
 answered on 03 Jan 2012
3 answers
117 views
I need to show expand icon against each node as the child nodes(if any) would be populated on demand. I dont want to use Load on demand directly, because our application can have more than 4000 child nodes(around 50000-100000). 
Is there any way by which the child nodes will have the expand icon without keeping the expandmode=webservice, so that when the user expands the node, on client side the ajax request will fire and will bring the child nodes and keep appending it on regular intervals(or through webworkers in case of html5).
Bozhidar
Telerik team
 answered on 03 Jan 2012
3 answers
77 views
Hi,
i am performing transfer among 7 radlistboxs on OnClientDropped event using "transferManager.performTransfer" method in javascript .

 

<script id="ListBoxItemTransfer" type="text/javascript">

 

function lbdropped(sender, args) {

sender.trackChanges();

 

var destinationListBox = transferManager.performTransfer(sender, args);

sender.commitChanges();

 

//Call back function

 

var senderListboxId = sender.get_id();

 

if (senderListboxId == 'rlbFuncImprovement' || senderListboxId == 'rlbTechImprovement' || senderListboxId == 'rlbConsolidation') {

 

var objectIds = '';

 

var items = args.get_sourceItems();

 

var i = 0;

 

for (i = 0; i < items.length; i++) {

 

if (objectIds == '') {

objectIds = items[i].get_value();

}

 

else {

objectIds = objectIds +

 

',' + items[i].get_value();

}

}

 

var arrgument = senderListboxId + ',' + objectIds + ", 0";

CallServer(arrgument,

 

'');

}

}

 

//Multi-list box transfer generic code

(

 

function ($) {

transferManager =

 

function () { }

transferManager.performTransfer =

 

function (sender, args) {

 

var destinationItemIndex = this._getDestinationIndex(args);

 

var destinationListBox = this._getDestinationListBox(args);

 

if (destinationListBox == null || destinationListBox.get_id() == document.getElementById('rlbProposed').id)

 

return;

 

var reorderIndex = args.get_dropPosition() == 0 ?

destinationItemIndex : destinationItemIndex + 1;

 

var items = args.get_sourceItems();

 

this._transfer(items, destinationListBox, reorderIndex);

 

return destinationListBox;

}

transferManager._transfer =

 

function (items, destination, reorderIndex) {

$.each(items,

 

function (index, item) {

destination.trackChanges();

destination.get_items().insert(reorderIndex, item);

destination.commitChanges();

});

}

transferManager._getDestinationIndex =

 

function (args) {

 

var destinationItem = args.get_destinationItem();

 

if (destinationItem)

 

return destinationItem.get_index();

 

return 0;

}

transferManager._getDestinationListBox =

 

function (args) {

 

var destinationItem = args.get_destinationItem();

 

if (destinationItem) {

 

var id = destinationItem.get_listBox().get_id();

 

return $find(id);

}

 

var parent = $(args.get_htmlElement()).parent();

 

if (parent.is(".RadListBox")) {

 

var id = parent[0].id;

 

return $find(id);

}

 

else if (parent.is(".rlbGroup")) {

 

var id = parent[0].parentNode.id;

 

return $find(id);

}

 

return null;

}

})($telerik.$);

 

</script>



I want that First listbox do the copy item functionality to other listbox, whereas other listboxs do the move item functionality.
How can i achieve this?
Bozhidar
Telerik team
 answered on 03 Jan 2012
9 answers
118 views
all I need is for a simple edit form to have columns instead of being one too long coluns. but when I use this:
<EditFormSettings ColumnNumber="2" >
                <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                    Width="100%" />
                <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                <EditColumn ButtonType="ImageButton" UpdateText="Update record"
                    UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                </EditColumn>
                <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
            </EditFormSetting

thank you.
regina
Top achievements
Rank 1
 answered on 03 Jan 2012
2 answers
582 views

I am creating a radtreeview context menu with an item 'Open link in new tab'.

I have created a context menu server side and assigned it to all nodes, but problem is I need to set the NavigateURL property of the context menu and this is different for every node.

I tried using the OnClientContextMenuItemClicked and then tried using Window.Open in the javascript function:

function

ContextMenuClicked(sender, args) {

  window.open(args._node._properties._data.value,

'_blank');

}
This function get the value property of the treeview node where the URL is stored, but unfortuanetely this doesn't work because it is stopped by the IE popup blocker.

I suppose I could create a unique context menu for every single node - but there might be hundreds of nodes and I worry this would make things slow.

Please can you think of a way I can solve this problem?

Many thanks for your help

 

richard
Top achievements
Rank 1
 answered on 03 Jan 2012
3 answers
57 views
Hi!...
some days ago, telerik send me a solution for show slidepane on the right opent to Bottom.
This works perfectlly in FF but no in IE.

In FF:






in IE:




How I can Fix this?
Thanks!
Dobromir
Telerik team
 answered on 03 Jan 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?