Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
94 views
I have two types of users for the website, admin and non-admin. Both users can edit the data using the edit form, but only admin can edit the password textbox. I plan to make the text box visible only to the admin

During painting the edit form, the application should check whether the user is an admin (using a variable stored in Default.aspx.cs) and change the value for the Visible properties for the textbox accordingly.

<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Password") %>' Visible='<%# if (loggedInUser == admin) {true;} else {false;} %>' ></asp:TextBox>


Can anyone tell me how to do this. The code above wouldn't compile and I'm a newbie in web programming.

Thanks.
Iris
Top achievements
Rank 1
 answered on 02 Aug 2012
0 answers
93 views
I receive this error while trying to perform an INSERT with EntityDataSource and the RadGrid. The odd thing is that the value is in fact inserted, but the error persists. Perhaps it has something to do w/ the EF or a problem with the reference value for the User object.

I need to manually set the value for UserID when creating a Scenario and when I try to set it in RadGridScenarios_InsertCommand event I get the error. If I do not manually set via code and manually set it in the UI there is no error (unless I reference a UserID which doesn't exist in Users table), but only when I try to set via code.

Before you ask... Yes UserID actual exists in the Users table and Scenarios.UserID references Users.UserID.

SQL Code:

CREATE TABLE Users
(
    UserID                    int                IDENTITY PRIMARY KEY            NOT NULL
    ,FirstName                varchar(30)                            NOT NULL
    ,LastName                varchar(30)                            NOT NULL
    ,WindowsLogin            varchar(30)                            NOT NULL
    ,EmailAddress            varchar(30)
    ,[Disabled]                bit                DEFAULT 0
    ,Administrator            bit                DEFAULT 0
)
GO

INSERT INTO Users(FirstName, LastName, WindowsLogin) VALUES('MyFirst', 'MyLast', 'MMyLast')

GO

CREATE TABLE Scenarios
(
    ScenarioID            int IDENTITY PRIMARY KEY NOT NULL
    ,Title                            varchar(30) NOT NULL
    ,Notes                            varchar(1000)
    ,UserID                            int REFERENCES Users(UserID) NOT NULL
    ,DateCreated                    datetime DEFAULT(GETDATE())
)


ASPX Code
<telerik:RadGrid 
            ID="RadGridScenarios"
            runat="server" 
            AutoGenerateColumns="False" 
            CellSpacing="0" 
            DataSourceID="EntityDataSourceScenarios" 
            GridLines="None" 
            AllowAutomaticDeletes="True" 
            AllowAutomaticInserts="True" 
            AllowAutomaticUpdates="True"
            OnInsertCommand="RadGridScenarios_InsertCommand">

            <MasterTableView 
                DataKeyNames="ScenarioID" 
                DataSourceID="EntityDataSourceScenarios"
                CommandItemDisplay="Top">
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>

                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>

                <Columns>
                    <telerik:GridBoundColumn 
                        DataField="Title" 
                        FilterControlAltText="Filter Title column" 
                        HeaderText="Title" 
                        SortExpression="Title" 
                        UniqueName="Title">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn 
                        DataField="Notes" 
                        FilterControlAltText="Filter Notes column" 
                        HeaderText="Notes" 
                        SortExpression="Notes" 
                        UniqueName="Notes">
                    </telerik:GridBoundColumn>
                </Columns>

                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                </EditFormSettings>

            </MasterTableView>

            <FilterMenu EnableImageSprites="False"></FilterMenu>

        </telerik:RadGrid>

C# Code
protected void RadGridScenarios_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            Hashtable values = new Hashtable();
            item.ExtractValues(values);
            Scenario scenario = new Scenario();
            item.UpdateValues(scenario);
            scenario.UserID = 1 //this.Database.Users.Single(u => u.WindowsLogin == username).UserID;
      }

Thanks,

Steve
Steve
Top achievements
Rank 1
 asked on 01 Aug 2012
3 answers
59 views
Hi,

I am working on RadScheduler. My question is can we extend the start data and end date timings iin Advanced Edit form. Some of my clients are based in other countries and if I want to schedule a meeting after 6 pm or before 8 am. Right now I am not able to do that as my Advanced Edit form only shows timings from 8am to 5:30 pm. I did went through all the examples in the Radcontrols for ASP.NET AJAX Q2 2012 and all of them have the start and end timings 8:00am - 5:30 pm.

Please advice.

Thanks,
Rakesh
Rakesh
Top achievements
Rank 1
 answered on 01 Aug 2012
17 answers
305 views
Hi !

I have a little problem with the Radschulder DayView.

We use our own timeslot context menues, now when a a user selects some timeslots, and click on a context menue,
we call the (server side api)

TimeSlotContextMenuItemClicking(object sender, TimeSlotContextMenuItemClickingEventArgs e)


and wanted to get the selected timeslot begin/end time (let us say from 08:00am to 09:30am) with

e.TimeSlot.Start;
e.TimeSlot.End;


but all we get in these to values is, the timeslot where the user hit the context menue (always 30 minutes).

Is there a chance to get the complete selected timeslots, as it is used when adding an appointment client side ?

with best regards
Markus
Rakesh
Top achievements
Rank 1
 answered on 01 Aug 2012
2 answers
174 views

Hi guys, I am having trouble doing something I thought would be simple.

The scenario:
1. A combobox on a page with autopostback set to true and a sub in the codebehind that I want to fire whenever the combobox changes.
Protected Sub cmbxHerbicide_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles cmbxHerbicide.SelectedIndexChanged
Dim con As New S
.............
..............
End Sub

2. On page load I grab a querystring and use it to change the combobox.
cmbxHerbicide.SelectedValue = Request.QueryString("ActiveID")

Ok, when I run this the combobox is changed as expected but the sub does not fire.
So I thought I would try:

cmbxHerbicide.SelectedValue = Request.QueryString("ActiveID")
cmbxHerbicide_SelectedIndexChanged(e, e)

This produces an error.
Unable to cast object of type 'System.EventArgs' to type 'Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs'

How do I get around this? 

I had expected that if I had AutoPostback set to true, and I changed the selection then the SelectedIndexChanged would fire.

What event args do I need to send?

Cheers

Ian
PS. The sub fires fine if I manually change the combobox.  The reason I am doing it in this way is that sometimes I want to run the code from a value pulled from a querystring, but once the user is on the page they can then go and select other values.  A worst case scenario is that I duplicate lots of code, I don't want to do that, the simple solution is to change the selection and call the sub.

Ian
Top achievements
Rank 1
 answered on 01 Aug 2012
0 answers
81 views
I am using an EditCommandColumn to Edit/Update/Insert records but when I use custom images instead of the default text, there is an unnecessary line break between the Update/Cancel images in Edit Mode as well as the Insert/Cancel images in Insert Mode. If I leave the default they display side by side. I am not specifying a header or item width and even if I do, I get the same results. The column widths are adjusting as necessary when I am using text. I can't seem to find any properties in the column to set any sort of image display layout.

<telerik:GridEditCommandColumn  ButtonType="ImageButton" EditImageUrl="images/edit.gif" UpdateImageUrl="images/update.gif" InsertImageUrl="images/update.gif" CancelImageUrl="images/delete.gif"></telerik:GridEditCommandColumn>

Any ideas?
License
Top achievements
Rank 1
 asked on 01 Aug 2012
1 answer
180 views
Hello,

I am finding the behavior of the HideOnBlur property a little difficult to understand.  If I add a RadMaskedTextBox to a page, apply a mask, and set the HideOnBlur property to true it works as I would expect.  When the control doesn't have focus the prompting characters and mask characters are hidden.  However, if I fill the .Text property with a value programatically, say in page load, then everything including the value I supplied is hidden until focus is given to the control and focus is switched off of the control and the onblur event is fired.

This results in a page loading and data that was supplied to the control doesn't show up.  Then you click inside the control and if you remove focus or start typing the supplied text appears.  Should I be supplying text to the RadMaskedTextBox in a different manner then using the .Text property of the control?

Thank you,
Jeremy

EDIT: Sorry...  this should be in the ASP.NET AJAX > General Discussions...  I didn't realize I was in the sub forum.
Jeremy
Top achievements
Rank 2
 answered on 01 Aug 2012
0 answers
38 views
Hi,

I have a load-on-demand RadTabStrip inside a Window that is set to a fixed width and height (the window, that is).  My problem is that the last PageView attached to the RadMultiPage that is referenced by the RadTabStrip is a summary page that may overflow to the bottom of the RadWindow based on what the user selects under previous tabs, but the RadWindow does not display a scroll bar to reflect this.  I can only view the content that is at the bottom of the RadWindow by clicking on my mouse's scroll wheel.  I have tried to fix this by setting the height of that last RadPageView both client and server-side, and I can tell that it is in fact set to that height - but still no scroll bar.  Is there a way I can accomplish this?

Thank you.
Condorito
Top achievements
Rank 1
 asked on 01 Aug 2012
2 answers
108 views
Hi Telerik team,

I have a number of columns in my radgrid and when i try to move a particular column to another position, it actually swaps the columns instead of just placing the column of my choice in the place that i desire. Is there a way i can avoid that swap. I hope i made sense.

Thanks,
Chandra
Chandra
Top achievements
Rank 1
 answered on 01 Aug 2012
2 answers
96 views
I am using RadEditor with the MS Word spelling provider.  I used the instructions at http://www.telerik.com/community/forums/aspnet-ajax/spell/enabling-ms-word-spell-checking.aspx to get it working.

It is spell-checking, but it does not seem to be using the en-US.tdf file in my ~/App_Data/RadSpell/ directory.  The special words (medical terms) I added to the dictionary are still flagged as misspellings.  Also, I can rename the file, and it still does spell-checking.

Here is my markup:
<telerik:RadEditor runat="server" ID="edNotes" Height="200" Width="98%" ContentAreaMode="Iframe" EditModes="Design" 
	EnableResize="true" ToolsFile="~/App_Data/ToolsFile.xml" SpellCheckSettings-CustomDictionarySuffix="Custom"
   	SpellCheckSettings-DictionaryLanguage="en-US" SpellCheckSettings-DictionaryPath="~/App_Data/RadSpell/" 
	SpellCheckSettings-SpellCheckProvider="MicrosoftWordProvider" SpellCheckSettings-AllowAddCustom="true" />

I have the following in my Page_Load routine:
	edNotes.SpellCheckSettings.SpellCheckProviderTypeName = typeof(Telerik.Web.UI.WordSpellCheckProvider).AssemblyQualifiedName;
Is the MS Word provider supposed to use en-US.tdf, or does it use the dictionary that Word/Office uses? I tested that and it does not seem to be using the Word dictionary. Also, I need to get the Custom dictionary file working as well. Please comment on that as well. Thanks, - Tim
Rumen
Telerik team
 answered on 01 Aug 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?