Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
349 views
I have a radgrid that is bound to an EntityDataSource Control.  Everytime I insert a new record I receive the following error: Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.
Parameter name: id

Below is my markup.  Any thoughts would be greatly appreciated.  Thanks!

<

 

telerik:RadGrid runat="server" ID="RadGrid2" AllowPaging="True"

 

 

AllowSorting="True" Width="97%" DataSourceID="EntityDataSource1" AllowAutomaticInserts="True"

 

 

AllowAutomaticUpdates="True" ShowStatusBar="True"

 

 

GridLines="None"

 

 

AutoGenerateColumns="False" OnItemCommand="RadGrid2_ItemCommand" >

 

 

<PagerStyle Mode="NumericPages" AlwaysVisible="true" />

 

 

<MasterTableView Width="100%" CommandItemDisplay="Top"

 

 

DataSourceID="EntityDataSource1"

 

 

DataKeyNames="VendorCrewId">

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName"

 

 

SortExpression="FirstName" UniqueName="FirstName">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" SortExpression="LastName"

 

 

UniqueName="LastName">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Bio" HeaderText="Bio"

 

 

SortExpression="Bio" UniqueName="Bio" ItemStyle-Width="300px" ItemStyle-HorizontalAlign="NotSet">

 

 

<ItemStyle Width="300px" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridCheckBoxColumn DataField="IsActive" DataType="System.Boolean"

 

 

HeaderText="IsActive" SortExpression="IsActive" UniqueName="IsActive">

 

 

</telerik:GridCheckBoxColumn>

 

 

<telerik:GridBinaryImageColumn DataField="Image" HeaderText="Image" UniqueName="Upload" ImageAlign="NotSet"

 

 

ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit"

 

 

DataAlternateTextFormatString="Image of {0}">

 

 

<HeaderStyle Width="10%" />

 

 

</telerik:GridBinaryImageColumn>

 

 

<telerik:GridBoundColumn DataField="VendorCrewId" DataType="System.Int32"

 

 

HeaderText="VendorCrewId" ReadOnly="True" Visible="False" SortExpression="VendorCrewId"

 

 

UniqueName="VendorCrewId">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="CompanyEntities.CompanyEntityId"

 

 

DataType="System.Int32" HeaderText="Vendor Id"

 

 

SortExpression="CompanyEntities.CompanyEntityId"

 

 

Visible="False">

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

<EditFormSettings>

 

 

<EditColumn ButtonType="ImageButton" />

 

 

</EditFormSettings>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

Maria Ilieva
Telerik team
 answered on 10 Jun 2013
9 answers
449 views
hi,

Can i insert javascript code inside the telerik editor content.
ie. suppose i insert the code
,<script type='text/javascript' language='javascript'> alert("hello");</script>
 inside the editor content.
when i take its html, it should not be
&LT;SCRIPT TYPE='TEXT/JAVASCRIPT' LANGUAGE='JAVASCRIPT'&GT; ALERT("HELLO");&LT;/SCRIPT&GT;

i need to use this script content to alert hello.
i hope u got my purpose.
Marin Bratanov
Telerik team
 answered on 10 Jun 2013
18 answers
491 views
Hi,

I want to create a  telerik radgrid. But am stuck with the itemdatabound.

My current asp code is :

aspx code:



<asp:GridView ID="gvwUserList" runat="server" OnPageIndexChanging="gridView_PageIndexChanging" OnSorting="gridView_Sorting"
                                OnRowDataBound="testGrid_RowDataBound" CellPadding="4" ForeColor="#333333" Font-Size="Smaller" PageSize="12"
                                AllowPaging="True" GridLines="None" Width="900px" AutoGenerateColumns="false" ShowFooter="False" AllowSorting="True">
                                <AlternatingRowStyle BackColor="White" />
                                <Columns>
                                    <asp:TemplateField HeaderText="Select All" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left">
                                        <HeaderTemplate>
                                            <asp:CheckBox ID="chkHeader" runat="server" onclick="javascript:HeaderClick(this);" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkStatus" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="User Name" HeaderStyle-HorizontalAlign="Left" SortExpression="customername" ItemStyle-HorizontalAlign="Left">
                                        <ItemTemplate>
                                            <asp:HyperLink ID="hlkCustomerName" runat="server" ForeColor="#666666"></asp:HyperLink>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="User ID" SortExpression="userid" ItemStyle-HorizontalAlign="Left" Visible="false">
                                        <ItemTemplate>
                                            <asp:Label ID="lblCustomerID" runat="server" ForeColor="Black" Visible="false"> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="User ID" HeaderStyle-HorizontalAlign="Left" SortExpression="email" ItemStyle-HorizontalAlign="Left">
                                        <ItemTemplate>
                                            <asp:Label ID="lblemailaddress" runat="server" ForeColor="Black"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Employment Type" HeaderStyle-HorizontalAlign="Left" SortExpression="employmenttype" ItemStyle-HorizontalAlign="Left">
                                        <ItemTemplate>
                                            <asp:Label ID="lblEmploymentType" runat="server" ForeColor="Black"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="City" HeaderStyle-HorizontalAlign="Left" SortExpression="city" ItemStyle-HorizontalAlign="Left" Visible="false">
                                        <ItemTemplate>
                                            <asp:Label ID="lblCity" runat="server" Visible="false" ForeColor="Black"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="State" HeaderStyle-HorizontalAlign="Left" SortExpression="value" ItemStyle-HorizontalAlign="Left">
                                        <ItemTemplate>
                                            <asp:Label ID="lblState" runat="server" ForeColor="Black"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Phone Number" SortExpression="phonenumber" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <asp:Label ID="lblPhoneNumber" runat="server" ForeColor="Black"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Role Type" HeaderStyle-HorizontalAlign="Left" SortExpression="role" ItemStyle-HorizontalAlign="Left" Visible="false">
                                        <ItemTemplate>
                                            <asp:Label ID="lblRoleType" runat="server" ForeColor="Black" Visible="false"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Status" HeaderStyle-HorizontalAlign="Left" SortExpression="typedescription" ItemStyle-HorizontalAlign="Left" Visible="false">
                                        <ItemTemplate>
                                            <asp:Label ID="lblStatus" runat="server" ForeColor="Black" Visible="false"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <EditRowStyle BackColor="Gray" />
                                <HeaderStyle BackColor="#A2A6AF" Font-Bold="True" ForeColor="#990000" />
                                <PagerStyle BackColor="#A2A6AF" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#e5e5e5" />
                                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                <%--<SortedAscendingCellStyle BackColor="#F5F7FB" />
                    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                    <SortedDescendingHeaderStyle BackColor="#4870BE" />--%>
                            </asp:GridView>

******************************************************************************************************************************************************************

aspx.cs code :

protected void testGrid_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (Request.QueryString.ToString().Contains("email"))
        {
            email = Request.QueryString["email"].ToString();
            roleid = Request.QueryString["roleid"].ToString();

            email = QueryStringModule.Decrypt(email);
            roleid = QueryStringModule.Decrypt(roleid);
        }


        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            HyperLink userName = ((HyperLink)e.Row.FindControl("hlkCustomerName"));
            Label userId = ((Label)e.Row.FindControl("lblCustomerID"));
            Label emailaddress = ((Label)e.Row.FindControl("lblemailaddress"));
            Label employmenttype = ((Label)e.Row.FindControl("lblEmploymentType"));
            Label city = ((Label)e.Row.FindControl("lblCity"));
            Label state = ((Label)e.Row.FindControl("lblState"));
            Label phonenumber = ((Label)e.Row.FindControl("lblPhoneNumber"));
            Label roletype = ((Label)e.Row.FindControl("lblRoleType"));
            Label status = ((Label)e.Row.FindControl("lblStatus"));

            userName.Text = DataBinder.Eval(e.Row.DataItem, "customername").ToString();

            userId.Text = DataBinder.Eval(e.Row.DataItem, "userid").ToString();
            emailaddress.Text = DataBinder.Eval(e.Row.DataItem, "email").ToString();
            employmenttype.Text = DataBinder.Eval(e.Row.DataItem, "employmenttype").ToString();
            city.Text = DataBinder.Eval(e.Row.DataItem, "city").ToString();
            state.Text = DataBinder.Eval(e.Row.DataItem, "value").ToString();
            phonenumber.Text = DataBinder.Eval(e.Row.DataItem, "phonenumber").ToString();
            roletype.Text = DataBinder.Eval(e.Row.DataItem, "role").ToString();
            status.Text = DataBinder.Eval(e.Row.DataItem, "typedescription").ToString();

            string query = QueryStringModule.Encrypt(email);
            string query1 = string.Empty;
            if (roleid != string.Empty)
                query1 = QueryStringModule.Encrypt(roleid);
            else
                query1 = Request.QueryString["roleid"].ToString();
            string query2 = QueryStringModule.Encrypt(roletype.Text);
            string query3 = QueryStringModule.Encrypt(userId.Text);

            userName.NavigateUrl = Constants.RedirectPages.UserEntry + "?userid=" + query3 + "&roleid=" + query1 + "&email=" + query + "&userRole=" + query2;

        }
}


Here the problem is how to use the findcontrol method in itemdatabound based on my code.


Thank you in advance


Shinu
Top achievements
Rank 2
 answered on 10 Jun 2013
6 answers
360 views
Hallo, I'm testing RadCaptcha and I'm struck with a very odd behaviour.
If I use the "Captcha" method (I'm using the cache as storage since I disabled sessions) everything works correctly. If I enter the right code validation passes, otherwise validation fails.
If I use the "InvisibleTextBox" protection instead, validation always fails.
Here is the test string that I'm using, maybe I missed something on it:

<telerik:RadCaptcha ID="RadCaptcha1" ProtectionMode="InvisibleTextBox" MinTimeout="2" ErrorMessage="asdsdasd" Display="Static" runat="server"></telerik:RadCaptcha>

This is inside an asp Panel, together with the form fields, ajaxified with RadAjaxManager.
I check the validation in the button click event server side and RadCaptcha1.IsValid is always false and of course validation fails. Any hint to overcome this issue. I can exploit the invisibletextbox feature myself but the timer on form subit requires a bit more work and it is a pity not to use the built-in one inside RadCaptcha. Any hint will be much appreciated. I'm coding on ASP.NET 4.5.

Massimiliano
Top achievements
Rank 1
 answered on 10 Jun 2013
1 answer
359 views
Hi,
we're using JustGage (http://www.justgage.com/) to transform some <div> inside an ItemTemplate.

The problem is that client side the javascript works ever and only on the first loaded item.
We try to move the <script> tag inside the ItemTemplate, but in that way the script add more gauges ever in the first item <div>.

How can we run the script for each item loaded ?

<script type="text/javascript">
        $(document).ready(function () {
                    var gc = new JustGage({ id: "gaugeCosts", value: 4552, min: 0, max: 15000, title: "title 1" });
                    var gf = new JustGage({ id: "gaugeFaults", value: 12, min: 0, max: 100, title: "title 2" });
                    var gm = new JustGage({ id: "gaugeMaintenance", value: 95, min: 0, max: 100, title: "title 3" });
            });
    </script>

<telerik:RadListView ID="rlDash" runat="server" onneeddatasource="rlDash_NeedDataSource" onitemcommand="rlDash_ItemCommand">
            <ItemTemplate>
                <div class="itemDash">
                    <div class="itemDashText">
                        <div style="float:left;width:40%;margin-right:3px;">
                            <asp:Label runat="server" ID="lblID" Text='<%# Eval("id") %>' Visible="false"></asp:Label>
                            <asp:LinkButton runat="server" ID="lblDescription" CommandName="Select" CssClass="itemDashTitle" ToolTip="<%$ Resources:Locations, localita_ttVisualizza %>"><%# Eval("description") %></asp:LinkButton>
                            <asp:ImageButton runat="server" ID="btnDelete" Height="20px" Width="20px" CommandName="Delete" ImageUrl="~/Images/delete.png" ToolTip="<%$ Resources:Locations, localita_ttElimina %>"/>
                        </div>
                        <div style="float:right;width:50%;">
                            <div class="itemDashGauge" id="gaugeCosts">
                            </div>
                            <div class="itemDashGauge" id="gaugeFaults">
                            </div>
                            <div class="itemDashGauge" id="gaugeMaintenance">
                            </div>
                        </div>
                    </div>
                </div>
            </ItemTemplate>
        </telerik:RadListView>

Eyup
Telerik team
 answered on 10 Jun 2013
1 answer
72 views
Hi,
I have a complex AJAXified page with lot of controls like buttons and one RadUpload.

I want to show RadProgress only on the upload but it is reacting on all buttons etc.
Can I define controls (or processes) for which progress has to be shown?

Marc
Plamen
Telerik team
 answered on 10 Jun 2013
1 answer
76 views
Hi, When someone clicks a timeslot i want to add border top to a color (100% width of scheduler).

I know this line is wrong: //args.getTimeSlotFromDomElement().style.borderColorTop = "red";

But i cant figure out how i should do it.


function OnClientTimeSlotClick(sender, args) {
                selectedResource = "";
                if (args.get_targetSlot()) {
                    selectedResource = args.get_targetSlot().get_resource().get_text();
                    var tmpTime = args.get_targetSlot().get_startTime("HH:mm");
                    var selectedTime = new Date(tmpTime);
                    selectedResourceKey = args.get_targetSlot().get_resource().get_key();
 
                    // Clears the lists
                    $('#InformationPanel ul li').html('');
                     
                    // Displays data in div.
                    $('#InformationPanel').find('.roomName').append("<strong>Rum:</strong> " + selectedResource);
                    $('#InformationPanel').find('.appointmentTime').append("<strong>Tid:</strong> " + selectedTime.format("HH:mm"));
 
 
                    activeTimeslot = args.get_targetSlot();
 
                    //args.getTimeSlotFromDomElement().style.borderColorTop = "red";
                }
            }
Plamen
Telerik team
 answered on 10 Jun 2013
1 answer
83 views
<telerik:RadMonthYearPicker runat="server" Culture="vi-VN">
</telerik:RadMonthYearPicker>

With above simple sample, RadMonthYearPicker does not work. Whenever you select a month, it always returns the first month, Jan.

Tested with other culture and it works but vi-VN.

Something wrong with javascript?
Eyup
Telerik team
 answered on 10 Jun 2013
1 answer
161 views
I am using IE8 browser, I have the Telerik Radgrid programmed for multiselection. When client presses 'Ctrl' and selects multiple rows, the text of all the rows are getting selected. Please look at the attached image, which shows the issue. Please let me know a solution for this issue.
Princy
Top achievements
Rank 2
 answered on 10 Jun 2013
1 answer
1.1K+ views
I'm populating a Radgrid in code behind and I am having some difficulty understanding how to get my image to appear.

The data column I'm trying to read from is called 'ImageUrl" however my src is an empty string when I build and run the project.

Here is the code for the GridImageColumn.

GridImageColumn gi1 = new GridImageColumn();
gi1.DataAlternateTextField = "ImageUrl";
gi1.DataImageUrlFields = new string [] {"ImageUrl"};
//gi1.DataImageUrlFormatString = "/{0}";
gi1.HeaderText = "Image";
gi1.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
gi1.Visible = true;
gi1.ImageAlign = ImageAlign.Middle;
gi1.ImageHeight = Unit.Pixel(25);
gi1.ImageWidth = Unit.Pixel(25);
rg1.MasterTableView.Columns.Add(gi1);

Is there a property that I'm not setting or setting incorrectly? I was assuming that the DataImageUrlFields would read the data just like a GridBoundColumn would read it's DataField.
Princy
Top achievements
Rank 2
 answered on 10 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?