Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
101 views
Hello

    I am using Radchart in a usercontrol for one of our application. The version of Telerik I have is 2012.1.215.40. I have Windows7 OS and IIS7. I have required Web.config entries in both System.Web and System.WebServer (Actually the entries were generated by the smarttag "Add RadChart HTTP Handler to Web.Config" option).

    The radchart shows up fine for the first time. When i click the same page from the menu, the rad chart shows up a popup "Error loading RadChart image"

  I tried the suggestions given by Evgenia in this post . Even setting usesession=false and setting the temp folder property resulting in the same sequence, first time it loads properly and second time when I load the page again it shows the error popup.

  Please help

Thanks
Saran
Nemi
Top achievements
Rank 1
 answered on 25 Oct 2012
0 answers
123 views
Hello,

Can someone explain or point me to a tutorial where I can have multiple windows nested in a tab strip.....with separate executing domains. So I guess what I'm asking is if there is a way to have one window nested in one tab using Chrome and the other tab/window using IE or Firefox?


So I might not be using the terms exactly correct so let me explain. I would like to have the tab strip with different tabs and the windows in that tab kept separate.

So user loads the default page and it has two buttons. New Tab Secured & New Tab Unsecured. The tab strip would be bound to an object and clicking either of the buttons would add another element to the collection so the tab strip would update with the new tab.

New Tab Secure would pop a modal window asking for credentials and a tab nickname (optional). Once entered it would go to an internal intranet site and the window of that tab would display the web page with the user logged in.

Now here is the trick that I am really unsure of.

New Tab Unsecure would open a new tab to the same site but of course we DON'T want the user logged in. PROBLEM. If for example IE is used then UNSECURED will be reading from the same cookies etc. and it will use the user credentials.

What I am desiring to provide to users of the system is the ability for them in one tab to have a administration login to make crud changes to the site. In the other tab see the impact of those CRUD operations.

Thank You
JB

Systems
Top achievements
Rank 1
 asked on 25 Oct 2012
6 answers
214 views
hi,
the parent is a sharepoint page, which has a webpart user control, which contains an iframe, which contains a user control that holds a radgrid control.
the radgrid has sorting filtering and paging enabled, i am using simple databinding and everything seems to work fine except the paging. lets say i have |<   <  1 2 3 4 5 >  >|   when i click on 2, the page posts back and the 2nd page is shown correctly and the number 2 is higlighted and same is the case with 3 and 4, however when i click on 1 (when the current page is 2) , both 1 and 2 are highlighted, the page does a postback but the contents are still of page 2, the next and previous arrows also exhibit the same behaviour. i am using the Black Skin and 2009.1.402.20 version., no matter what i try to do i cannot go back to page 1. this is the same behaviour in IE and FF

i have been reading couple of other threads which recommend using advanced databinding using needdatasource, i have tried that, but strangely the needdatasource method is not getting invoked automatically, the grid is blank.
when using the simple databinding i called the ShowListings() method from page_init(), but i commented those lines, because of the needdatasource method.

please advise.

here is my source code

 

<telerik:RadGrid ID="gvListing" runat="server" Skin="C21Skin" EnableEmbeddedSkins="False" AllowSorting="True" SortingSettings-SortedBackColor="#303030" EnableViewState="true"

 

 

AllowPaging="True" GridLines="None" AutoGenerateColumns="False" AllowFilteringByColumn="true" OnInit="gvListing_Init" OnNeedDataSource="gvListing_NeedDataSource"

 

 

Width="450px" Height="765px" PageSize="10" ShowStatusBar="True" FilterItemStyle-HorizontalAlign="Left" OnItemDataBound="gvListing_ItemDataBound" >

 

 

<PagerStyle Mode="NextPrevAndNumeric" Wrap="False" AlwaysVisible="true" Position="TopAndBottom"></PagerStyle>

 

 

<MasterTableView TableLayout="Fixed">

 

 

<Columns>

 

 

<telerik:GridTemplateColumn UniqueName="Select" Display="true" HeaderText="" ItemStyle-Width="8px"

 

 

ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="8px" HeaderStyle-HorizontalAlign="Center" ItemStyle-Wrap="true"

 

 

AllowFiltering="FALSE">

 

 

<ItemTemplate>

 

 

<asp:CheckBox runat="server" ID="chkSelectListing" OnCheckedChanged="chkSelectListing_OnCheckedChanged" AutoPostBack="true" />

 

 

<asp:Label ID="lblTrKey" Visible="false" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Tr_key") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Image" UniqueName="Image" AllowFiltering="false" ItemStyle-Width="60px" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="60px" HeaderStyle-HorizontalAlign="Center" ItemStyle-Wrap="true">

 

 

<ItemTemplate>

 

 

<div style="float:left;background-image:url('http://webservices.21online.com/public/imageresize.aspx?w=60&h=45&url=<%# DataBinder.Eval(Container.DataItem,"jpg_url") %>');background-repeat:no-repeat;width:60px;height:45px;z-index:1;vertical-align:bottom;text-align:right;">

 

 

<br/>

 

 

<div style="background-image:url('<%#Convert.ToInt32(DataBinder.Eval(Container.DataItem, "TotalPhotos").ToString()) > 5 ? "/21online/images/icons/yellow.gif" : "/21online/images/icons/red.gif"%>');background-repeat:no-repeat;z-index:2;width:26px;height:29px;vertical-align:middle;text-align:center;">

 

 

<span style="font-size:10pt;font-weight:bold;color:white;line-height:25px;vertical-align:baseline;"><%# DataBinder.Eval(Container.DataItem,"TotalPhotos") %></span>

 

 

</div>

 

 

</div>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn DataField="MLS_ID" Display="true" ItemStyle-ForeColor="white"

 

 

CurrentFilterFunction="StartsWith" AutoPostBackOnFilter="true" SortExpression="MLS_ID"

 

 

UniqueName="MLS_ID" HeaderText="MLS_ID" FilterControlWidth="40px" ItemStyle-Width="70px"

 

 

ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="70px" HeaderStyle-HorizontalAlign="Left" ItemStyle-Wrap="true">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn Display="true" ItemStyle-ForeColor="white"

 

 

SortExpression="Address" UniqueName="Address" HeaderText="Address" ItemStyle-Width="113px" AllowFiltering="FALSE"

 

 

ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="113px" HeaderStyle-HorizontalAlign="Left" ItemStyle-Wrap="true">

 

 

<ItemTemplate>

 

 

<asp:Label ID="lblAddress" CssClass="white11" Visible="true" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Address") %>'></asp:Label>,

 

 

<asp:Label ID="lblCity" CssClass="white11" Visible="true" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"city") %>'></asp:Label>,

 

 

<asp:Label ID="lblState" CssClass="white11" Visible="true" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"state") %>'></asp:Label>,

 

 

<asp:Label ID="lblZip" CssClass="white11" Visible="true" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"zip") %>'></asp:Label>

 

 

<asp:Label ID="lblImageURL" CssClass="white11" Visible="false" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"jpg_url") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn DataField="ListingType" Display="true" ItemStyle-ForeColor="white"

 

 

CurrentFilterFunction="StartsWith" AutoPostBackOnFilter="true" SortExpression="ListingType"

 

 

UniqueName="ListingType" HeaderText="Type" FilterControlWidth="10px" ItemStyle-Width="40px"

 

 

ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="40px" HeaderStyle-HorizontalAlign="Left" ItemStyle-Wrap="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Price" Display="true" ItemStyle-ForeColor="white"

 

 

CurrentFilterFunction="GreaterThan" AutoPostBackOnFilter="true" SortExpression="Price"

 

 

UniqueName="Price" HeaderText="Price" FilterControlWidth="45px" ItemStyle-Width="75px" DataFormatString="{0:c0}"

 

 

ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Left" ItemStyle-Wrap="true">

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings EnableRowHoverStyle="true">

 

 

<Scrolling SaveScrollPosition="true" UseStaticHeaders="true" AllowScroll="true" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

and here is the code behind

 

 

protected void gvListing_Init(object sender, System.EventArgs e)

 

{

 

GridFilterMenu menu = gvListing.FilterMenu;

 

 

int i = 0;

 

 

while (i < menu.Items.Count)

 

{

 

if (menu.Items[i].Text == "NoFilter" ||

 

menu.Items[i].Text ==

"Contains" ||

 

menu.Items[i].Text ==

"DoesNotContain" ||

 

menu.Items[i].Text ==

"StartsWith" ||

 

menu.Items[i].Text ==

"EndsWith" ||

 

menu.Items[i].Text ==

"EqualTo" ||

 

menu.Items[i].Text ==

"NotEqualTo" ||

 

menu.Items[i].Text ==

"GreaterThan" ||

 

menu.Items[i].Text ==

"LessThan"

 

 

 

 

)

{

 

switch (menu.Items[i].Text)

 

{

 

case "NoFilter":

 

{

menu.Items[i].Text =

"No Filter";

 

 

break;

 

}

 

case "Contains":

 

{

menu.Items[i].Text =

"Contains";

 

 

break;

 

}

 

case "DoesNotContain":

 

{

menu.Items[i].Text =

"Does Not Contain";

 

 

break;

 

}

 

case "StartsWith":

 

{

menu.Items[i].Text =

"Starts With";

 

 

break;

 

}

 

case "EndsWith":

 

{

menu.Items[i].Text =

"Ends With";

 

 

break;

 

}

 

case "EqualTo":

 

{

menu.Items[i].Text =

"Equal To";

 

 

break;

 

}

 

case "NotEqualTo":

 

{

menu.Items[i].Text =

"Not Equal To";

 

 

break;

 

}

 

case "GreaterThan":

 

{

menu.Items[i].Text =

"Greater Than";

 

 

break;

 

}

 

case "LessThan":

 

{

menu.Items[i].Text =

"Less Than";

 

 

break;

 

}

}

i++;

}

 

else

 

 

 

 

{

menu.Items.RemoveAt(i);

}

}

}

 

protected void gvListing_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

 

{

 

 

if (ListingsDS.Tables[0].Rows.Count > 0)

 

{

gvListing.DataSource = ListingsDS.Tables[0];

 

if (CrestNote.Visible == false)

 

{

gvListing.MasterTableView.Columns[4].HeaderText =

"";

 

}

}

 

else

 

 

 

 

{

lblNoOfListings.Text =

"The category you have selected does not require listings.";

 

}

}

 

private void ShowListings()

 

{

 

if (ListingsDS.Tables[0].Rows.Count > 0)

 

{

gvListing.DataSource = ListingsDS.Tables[0];

gvListing.DataBind();

 

if (CrestNote.Visible == false)

 

{

 

//gvListing.Columns[4].Display = false;

 

 

 

 

gvListing.MasterTableView.Columns[4].HeaderText =

"";

 

}

}

 

else

 

 

 

 

{

lblNoOfListings.Text =

"The category you have selected does not require listings.";

 

}

}

 

 

public void chkSelectListing_OnCheckedChanged(object sender, EventArgs e)

 

{

 

CheckBox cb = (CheckBox)sender;

 

 

GridDataItem item = (GridDataItem)cb.NamingContainer;

 

 

Label lblTKey = (Label)item["Select"].FindControl("lblTrKey");

 

 

Label lblAddress = (Label)item["Address"].FindControl("lblAddress");

 

 

Label lblCity = (Label)item["Address"].FindControl("lblCity");

 

 

Label lblState = (Label)item["Address"].FindControl("lblState");

 

 

Label lblZip = (Label)item["Address"].FindControl("lblZip");

 

 

Label lblImageURL = (Label)item["Address"].FindControl("lblImageURL");

 

 

string strTrKey = lblTKey.Text;

 

 

string strTrKeyAddress = lblAddress.Text + ", " + lblCity.Text + ", " + lblState.Text + " " + lblZip.Text;

 

 

string strTrKeyImg = lblImageURL.Text;

 

 

eCampaign_Cart nlList_cart;

 

nlList_cart = CartSession;

 

if (cb.Checked == true)

 

{

nlList_cart.AddOrModifyMember(

new eCampaign_CartItem(strTrKey, strTrKeyAddress, strTrKeyImg));

 

}

 

else

 

 

 

 

{

nlList_cart.DeleteMember(strTrKey);

}

CartSession = nlList_cart;

divCartItemCount.InnerHtml = nlList_cart.getPrintNumberOfItems();

 

}

 

protected void gvListing_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

 

{

 

if (e.Item is GridDataItem)

 

{

 

GridDataItem item = e.Item as GridDataItem;

 

 

string strTrKey = ((Label)item["Select"].FindControl("lblTrKey")).Text;

 

 

bool bSelected = false;

 

 

if (CartSession != null)

 

{

bSelected = CartSession.FindTrKeySelected(strTrKey);

 

if (bSelected)

 

{

 

CheckBox cb = (CheckBox)item["Select"].FindControl("chkSelectListing");

 

cb.Checked =

true;

 

}

}

}

}

Celestyn
Top achievements
Rank 1
 answered on 25 Oct 2012
2 answers
165 views
Hi ,

Using Telerik Ajax Q2 2009 

Using a rad window manager,  if I open a rad window and minimize it and then open another Rad window,  and then  I maximize the first Rad window the maximized window will be in the back and the second Rad window will be on top. 

I believe the issue is related to the z-Index of the maximized window,  is there a way to alter the z-index to set it to a highest number so it will open on top

Sincerely,

Fadi
Fadi
Top achievements
Rank 1
 answered on 25 Oct 2012
2 answers
354 views
Hello,
I have a radbutton with the buttontype of Togglebutton and would like the font size to change when the button is toggled - a larger font when it is selected and a smaller font when it is not.  I am trying to do this through a Css Class.  It seems like everything else works just fine - I can change the font family, font weight, background color, etc., but the font-size does not.  Please help.

Thanks.
Sheldon
Top achievements
Rank 1
 answered on 25 Oct 2012
17 answers
584 views
We are having a problem with our implementation of the RadAjaxPanels and are looking for some assitance and help understanding why we are seeing the behavior we are seeing. We also think there may be a bug involved?

The issue is that we need to have multiple AjaxPanels on a page. We want to load the content in them after the page loads. There may be a lot of content in each, so we want to fire off separate ajax requests for each one and have the data be handled as it returns.

We are making use of the javascript function:

    function pageLoad(sender, args) { 
        if (args._isPartialLoad == false) { 
            $find("RadAjaxPanel1").ajaxRequest(); 
            $find("RadAjaxPanel2").ajaxRequest(); 
        } 
    }  


However, we cannot get this to work properly. We have found that if we put more than 1 ajax request into the function above, we get strange behavior, even if requests are queued. We do not get the exact same behavior every time, but often we get:
1) Only 1 of the requests goes through and as a result only one of the panels gets updated
2) The 2nd request or any subsequent requests are made repeatedly in an infinite loop
3) Every now and then... it works

I have a simple project to reproduce some of these issues, including when using a RadAjaxManager. I also have the HTTP capture of the cases when the 2nd ajaxRequest repeasts in an infinite loop. Please let me how I can upload it. 

Thank you

-- Project notes
-Simple.aspx works fine
-Double.aspx has 2 AjaxPanels and does not work correctly. It has the behavior mentioned above approximately 90% of the time
-DoubleWithManager.aspx also has 2 AjaxPanels. While it functions correctly (since it does not contain 1 ajax calls in the pageLoad function), it is not the functionality we desire, as we want each panel to load asynchronously, not all of them at once, as this does.

In all cases, ajaxrequests done well after the page has fully loaded (such as by clicking one of the buttons) are handled fine. It is only these pageLoad requests that are causing problems.
Greg
Top achievements
Rank 1
 answered on 25 Oct 2012
2 answers
80 views
How can I close a radwindow from within a multipage pageview contenturl content page.
I have a radwindow that is used like a wizard to add a record and to subscribe to the new record.  I have the entire thing working but the second tab to subscribe does not cause the window to close.  Please help, this is urgent. thanks you.

below is the code I use when the subscribe is not within the tabstrip/multipage/pageview and it works great, please tell me what i need to add to close from within the tabstrip/multipage/pageview


function GetRadWindow() {
          var oWindow = null; if (window.radWindow)
              oWindow = window.radWindow; else if (window.frameElement.radWindow)
              oWindow = window.frameElement.radWindow; return oWindow;
      }
      
      function CloseModal() {
          // GetRadWindow().close();
          setTimeout(function () {
              GetRadWindow().BrowserWindow.refreshGrid()
              GetRadWindow().close();
 
          }, 0);
      }
regina
Top achievements
Rank 1
 answered on 25 Oct 2012
3 answers
142 views
How do I set data and/or perform custom operations when using the "AllowAutomaticUpdates" (Inserts/Deletes) property?

I note the "ItemInserted" and "ItemUpdated" events occur, but what about "ItemInserting" or "ItemUpdating" etc?
Eyup
Telerik team
 answered on 25 Oct 2012
2 answers
110 views
Hi all member
I have a RadWindow which set url window to another page.I show window with javascript .I want show window without postback server .
I show window with  javascript but it post to server .
please help to me for solution.
thanks
Marin Bratanov
Telerik team
 answered on 25 Oct 2012
3 answers
520 views
heey guys i got a strange error 

Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'FromDate'


<%@ Page Title="" Language="C#" MasterPageFile="~/ABBMaster.Master" AutoEventWireup="true"
    CodeBehind="UserEditPanel.aspx.cs" Inherits="HolidayTracker.Administrator.UserEditPanel" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainRegionContentPlaceHolder" runat="server">
    <telerik:RadScriptManager ID="rsmTelerik" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"></asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"></asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"></asp:ScriptReference>
        </Scripts>
    </telerik:RadScriptManager>
 
 
    <br />
 
<%--    <script type="text/javascript">
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                args.set_enableAjax(false);
            }
        }
    </script>--%>
    <asp:Panel ID="pnlContent" CssClass="pnlContent" runat="server">
 
        <asp:Panel ID="pnlHeader" CssClass="pnlHeader" runat="server">
        </asp:Panel>
        <asp:Panel ID="pnlBody" CssClass="pnlBody" runat="server">
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Skin="Default" LoadingPanelID="RadAjaxLoadingPanel1">
                <fieldset style="padding: 10px; margin-bottom: 10px;">
                    <legend>User form</legend>
                    <div class="formRowDiv">
                        <asp:Label ID="label4" CssClass="formLabel" runat="server" Text="Email"></asp:Label>
                        <telerik:RadComboBox ID="rcbSearch" CssClass="rowForm" runat="server" Width="260px"
                            Height="100px" EmptyMessage="Enter Email" EnableLoadOnDemand="true" AutoPostBack="true"
                            OnItemsRequested="rcbSearch_ItemsRequested" CausesValidation="false" OnSelectedIndexChanged="rcbSearch_IndexChanged">
                        </telerik:RadComboBox>
                        <asp:RegularExpressionValidator ID="revEmail" runat="server" Display="Dynamic" ControlToValidate="rcbSearch"
                            ValidationExpression="^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$"
                            ErrorMessage="Enter a valid email address" />
                        <asp:RequiredFieldValidator ID="rfvEmail" runat="server" Display="Dynamic" ControlToValidate="rcbSearch"
                            ErrorMessage="Can not be empty" CssClass="rowFormValidation" />
                    </div>
                    <div class="formRowDiv">
                        <asp:Label ID="label1" CssClass="formLabel" runat="server" Text="Firstname"></asp:Label>
                        <telerik:RadTextBox ID="rtbFirstName" CssClass="rowForm" runat="server" ReadOnly="True" />
                        <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" Display="Dynamic" ControlToValidate="rtbFirstName"
                            ErrorMessage="Can not be empty" CssClass="rowFormValidation" />
                    </div>
                    <div class="formRowDiv">
                        <asp:Label ID="label2" CssClass="formLabel" runat="server" Text="Lastname"></asp:Label>
                        <telerik:RadTextBox ID="rtbLastName" CssClass="rowForm" runat="server" ReadOnly="True" />
                        <asp:RequiredFieldValidator ID="rfvLastName" runat="server" Display="Dynamic" ControlToValidate="rtbLastName"
                            ErrorMessage="Can not be empty" CssClass="rowFormValidation" />
                    </div>
                    <div class="formRowDiv">
                        <asp:Label ID="label3" CssClass="formLabel" runat="server" Text="Username"></asp:Label>
                        <telerik:RadTextBox ID="rtbUserName" CssClass="rowForm" runat="server" ReadOnly="True" />
                        <asp:RequiredFieldValidator ID="rfvUserName" runat="server" Display="Dynamic" ControlToValidate="rtbUserName"
                            ErrorMessage="Can not be empty" CssClass="rowFormValidation" />
                    </div>
                    <div class="formRowDiv" style="display: none;">
                        <asp:Label ID="label5" CssClass="formLabel" runat="server" Text="AdAccount"></asp:Label>
                        <telerik:RadTextBox ID="rtbAdAccount" CssClass="rowForm" runat="server" ReadOnly="True" />
                    </div>
                    <div class="formRowDiv" style="display: none;">
                        <asp:Label ID="label6" CssClass="formLabel" runat="server" Text="AdDomain"></asp:Label>
                        <telerik:RadTextBox ID="rtbAdDomain" CssClass="rowForm" runat="server" ReadOnly="True" />
                    </div>
                    <div class="formRowDiv">
                        <asp:Label ID="label8" runat="server" Text="Role" CssClass="formLabel"></asp:Label>
                        <telerik:RadComboBox ID="rcbUserRoles" CssClass="rowForm" CheckBoxes="True" EmptyMessage="- Please select -"
                            runat="server" DataTextField="Name" DataValueField="RoleId">
                        </telerik:RadComboBox>
                        <asp:SqlDataSource ID="UserRoleSqlSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                            SelectCommand="SELECT * FROM [HtUserRole]"></asp:SqlDataSource>
                    </div>
                    <div class="formRowDiv">
                        <%--  <asp:Label ID="label7" CssClass="formLabel" runat="server" Text="Annual vacations"></asp:Label> --%>
                        <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
 
                            <telerik:RadGrid ID="rgAnnualVacation" runat="server" CellSpacing="0" GridLines="None" AllowPaging="True" AutoGenerateDeleteColumn="True"
                                OnInsertCommand="rgAnnualVacation_InsertCommand" OnDeleteCommand="rgAnnualVacation_DeleteCommand" Height="200px"
                                OnUpdateCommand="rgAnnualVacation_UpdateCommand" OnNeedDataSource="rgAnnualVacation_NeedDataSource">
 
                                <MasterTableView AutoGenerateColumns="false" DataKeyNames="AnnualVacationId" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
 
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="AnnualVacationId" Visible="false" DataType="System.Int32" FilterControlAltText="Filter AnnualVacationId column" HeaderText="AnnualVacationId" ReadOnly="True" SortExpression="AnnualVacationId" UniqueName="AnnualVacationId">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="UserId" Visible="false" DataType="System.Int32" FilterControlAltText="Filter UserId column" HeaderText="UserId" SortExpression="UserId" UniqueName="UserId">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="FromDate" DataType="System.DateTime" FilterControlAltText="Filter FromDate column" HeaderText="FromDate" SortExpression="FromDate" UniqueName="FromDate">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="ToDate" DataType="System.DateTime" FilterControlAltText="Filter ToDate column" HeaderText="ToDate" SortExpression="ToDate" UniqueName="ToDate">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="WorkingTime" DataType="System.Int32" FilterControlAltText="Filter WorkingTime column" HeaderText="WorkingTime" SortExpression="WorkingTime" UniqueName="WorkingTime">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="VacationDays" DataType="System.Double" FilterControlAltText="Filter VacationDays column" HeaderText="VacationDays" SortExpression="VacationDays" UniqueName="VacationDays">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridEditCommandColumn />
                                    </Columns>
 
                                    <EditFormSettings EditFormType="Template">
                                        <FormTemplate>
                                            <table>
                                                <tr>
                                                    <td>From</td>
                                                    <td>
                                                        <telerik:raddatepicker id="fromdatepicker" runat="server" dbselecteddate='<%# bind("fromdate") %>'
                                                            tabindex="4">
                                                        </telerik:raddatepicker>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>To</td>
                                                    <td>
                                                        <telerik:raddatepicker id="todatepicker" runat="server" mindate="1/1/1900" dbselecteddate='<%# bind("todate") %>'
                                                            tabindex="4">
                                                        </telerik:raddatepicker>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>Working time (%)</td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="txtWorkingTime" runat="server" NumberFormat-DecimalDigits="0" DbValue='<%# Bind("WorkingTime") %>'></telerik:RadNumericTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>Vacation days</td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="txtVacationDays" runat="server" NumberFormat-DecimalDigits="2" DbValue='<%# Bind("VacationDays") %>'></telerik:RadNumericTextBox>
                                                    </td>
                                                </tr>
 
                                            </table>
 
                                            <table style="margin-top: 15px;">
                                                <tr>
                                                    <td>
                                                        <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                            runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button
                                                    </td>
                                                    <td>
                                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                            CommandName="Cancel"></asp:Button>
                                                    </td>
                                                </tr>
                                            </table>
                                        </FormTemplate>
                                    </EditFormSettings>
                                    <%--<CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true" ShowExportToCsvButton="true" />--%>
                                </MasterTableView>
                                <FilterMenu EnableImageSprites="False">
                                </FilterMenu>
 
                            </telerik:RadGrid>
                        </telerik:RadAjaxPanel>
                    </div>
                    <div class="formRowDiv">
                        <telerik:RadButton ID="rbBack" CssClass="rowButton" runat="server" Text="Back" OnClick="rbBack_Clicked"
                            CausesValidation="false" />
                        <telerik:RadButton ID="rbSave" CssClass="rowButton" runat="server" Text="Save" OnClick="rbSave_Clicked" />
                    </div>
                </fieldset>
            </telerik:RadAjaxPanel>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
            </telerik:RadAjaxLoadingPanel>
        </asp:Panel>
        <asp:Panel ID="pnlFooter" CssClass="pnlFooter" runat="server">
        </asp:Panel>
    </asp:Panel>
</asp:Content>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HolidayTracker.Data.Model;
using Telerik.Web.UI;
using HolidayTracker.Code;
using System.Collections;
 
namespace HolidayTracker.Administrator {
    public partial class UserEditPanel : System.Web.UI.Page {
 
        private List<AnnualVacation> annualVacations = new List<AnnualVacation>();
 
        private Boolean newUser;
        private HtUser paramUser;
        private HtUser user;
        private HtUser User {
            get {
                user = HtUser.INIT_USER(this.Page, true);
                return user;
            }
        }
 
        protected void Page_Load(object sender, EventArgs e) {
            getParameters();
            if (!IsPostBack) {
 
                bindData();
 
                fillFieldsWithData();
                initFieldSettings();
            }
        }
 
        private void getParameters() {
            if (Page.Request["userId"] != null) {
                int userId = Constants.TryConvert(Page.Request["userId"], this.Page);
                this.paramUser = HtUser.GetById(userId);
            } else {
                this.paramUser = new HtUser();
            }
        }
 
        private void initFieldSettings() {
            if (!newUser) {
                this.rcbSearch.Enabled = false;
            }
        }
 
        private void bindData() {
            this.rcbUserRoles.DataSource = this.UserRoleSqlSource;
            this.rcbUserRoles.DataBind();
 
            //fill viewstate with annual vacations if empty
            if (paramUser != null && paramUser.AnnualVacations.Any())
            {
                if (ViewState["AnnualVacationSource"] == null)
                {
                    annualVacations.AddRange(paramUser.AnnualVacations);
                    ViewState["AnnualVacationSource"] = annualVacations;
                }
            }
        }
 
        private void fillFieldsWithData() {
            if (paramUser != null) {
                this.rtbFirstName.Text = paramUser.FirstName;
                this.rtbLastName.Text = paramUser.LastName;
                this.rtbUserName.Text = paramUser.UserName;
                this.rcbSearch.Text = paramUser.Email;
                this.rtbAdAccount.Text = paramUser.AdAccount;
                this.rtbAdDomain.Text = paramUser.AdDomain;
 
                //UserRole
                IEnumerable<HtUserRole> userRoles = paramUser.HtUserRoles != null ? paramUser.HtUserRoles : null;
                if (userRoles != null && userRoles.Count() > 0) {
                    foreach (RadComboBoxItem rcbi in rcbUserRoles.Items) {
                        rcbi.Checked = false;
                        foreach (HtUserRole ur in userRoles) {
                            if (ur.RoleId.ToString() == rcbi.Value) {
                                rcbi.Checked = true;
                                break;
                            }
                        }
                    }
                }
            }
        }
 
        protected void rcbSearch_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) {
            if (e.Text != null && e.Text.Length > 2) {
                IEnumerable<HtUser> result = null;
                AdLookup lookup = new AdLookup();
                result = lookup.SearchAdUserByEmail(e.Text);//HtUser.SearchByEmail(e.Text);
                if (result != null && result.Count() > 0) {
                    foreach (HtUser user in result) {
                        this.rcbSearch.Items.Add(new RadComboBoxItem(user.Email, user.UserId.ToString()));
                    }
                }
            }
        }
 
        protected void rcbSearch_IndexChanged(object sneder, RadComboBoxSelectedIndexChangedEventArgs e) {
            string email = e.Text;
            AdLookup lookup = new AdLookup();
            paramUser = lookup.GetAdUserByEmail(email);
            fillFieldsWithData();
        }
 
        private void saveData() {
            HolidayTrackerEntities ctx = HtEntityFactory.Context;
            HtUser userToSave = ctx.HtUsers.Where(u => u.UserId == paramUser.UserId).FirstOrDefault();
            if (userToSave == null) {
                userToSave = new HtUser();
                userToSave.IsNew = true;
            }
            userToSave.FirstName = this.rtbFirstName.Text;
            userToSave.LastName = this.rtbLastName.Text;
            userToSave.UserName = this.rtbUserName.Text;
            userToSave.Email = this.rcbSearch.Text;
            userToSave.AdAccount = this.rtbAdAccount.Text;
            userToSave.AdDomain = this.rtbAdDomain.Text;
 
            //UserRole
            foreach (RadComboBoxItem rcbi in rcbUserRoles.Items) {
                HtUserRole newUserRole = HtUserRole.GetById(int.Parse(rcbi.Value));
 
                if (rcbi.Checked) {
                    if (userToSave.HtUserRoles.Where(x => x.RoleId == newUserRole.RoleId).Count() == 0) {
                        userToSave.HtUserRoles.Add(newUserRole);
                    }
                } else {
                    if (userToSave.HtUserRoles.Where(x => x.RoleId == newUserRole.RoleId).Count() > 0) {
                        userToSave.HtUserRoles.Remove(newUserRole);
                    }
                }
            }
 
            if (userToSave.IsNew) {
                ctx.AddToHtUsers(userToSave);
            }
 
            if (((List<AnnualVacation>)ViewState["AnnualVacationSource"]) != null) {
                List<AnnualVacation> vacationToSave = (List<AnnualVacation>)ViewState["AnnualVacationSource"];
                IEnumerable<AnnualVacation> existing = paramUser.AnnualVacations;
                foreach (AnnualVacation toSave in vacationToSave) {
                    //if (toSave.IsNew) {
                    //    ctx.AddToAnnualVacations(toSave);
                    //}
                        
                    //Zu löschende aus context löschen
                }
            }
 
            ctx.SaveChanges();
        }
 
        protected void rbBack_Clicked(object sender, EventArgs e) {
            Response.Redirect("~/Administrator/UserPanel.aspx");
        }
 
        protected void rbSave_Clicked(object sender, EventArgs e) {
            saveData();
            fillFieldsWithData();
        }
 
        protected void rgAnnualVacation_InsertCommand(object sender, GridCommandEventArgs e) {
            try {
                GridEditableItem item = e.Item as GridEditableItem;
                Hashtable values = new Hashtable();
                item.ExtractValues(values);
 
                AnnualVacation newAnnualVacation = new AnnualVacation();
                item.UpdateValues(newAnnualVacation);
                //newAnnualVacation.IsNew = true;
 
                ((List<AnnualVacation>)ViewState["AnnualVacationSource"]).Add(newAnnualVacation);
            } catch {
                //Hier fehlermeldung
            }
 
        }
 
        protected void rgAnnualVacation_DeleteCommand(object sender, GridCommandEventArgs e) {
            int annualVacationId = int.Parse((e.Item as GridDataItem).GetDataKeyValue("AnnualVacationId").ToString());
            ((List<AnnualVacation>)ViewState["AnnualVacationSource"]).
                Remove(((List<AnnualVacation>)ViewState["AnnualVacationSource"]).
                Where(av => av.AnnualVacationId == annualVacationId).FirstOrDefault());
        }
 
        protected void rgAnnualVacation_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) {
            rgAnnualVacation.DataSource = ViewState["AnnualVacationSource"];
            if (rgAnnualVacation.DataSource == null)
            {
                rgAnnualVacation.DataSource = String.Empty;
            }
        }
 
        protected void rgAnnualVacation_UpdateCommand(object sender, GridCommandEventArgs e) {
 
        }
       
         }
}


plzz  dont give me just a reference plzz help thanks allot !!!!!  

Thanks for fast answer ! 
Pavlina
Telerik team
 answered on 25 Oct 2012
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?