Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
85 views
I'm using the Web Forms RadGrid with an ORM tool that has attributes providing data constraints (required field and other validation rules) as part of its model. What I'm trying to do it come up with a general-purpose way to assign validators to either the in-place editing columns or the automatically generated edit/insert form.

This is a sample of the code I currently have. Based on other examples, I've put it in the pre-render event, but if there's a better event to use for this, I'd be happy to know it. The EntityProperty is the object that allows me to know all the constraints of my entity, which corresponds to a column in a data table. So I'm trying to retrieve the editable item from the RadGrid so I can create and associate the appropriate validator(s) to it based on the validation rules for my entity. How do I get to the editing control for the item in the grid that corresponds to the databound column?

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (!this.IsPostBack)
    {
        GridTableView tv = RadGrid1.MasterTableView;
        foreach (GridDataItem gdi in tv.Items)
        {
            // the spelunking isn't quite correct yet. Still working on it.
            EntityProperty ep = entityProps.
                    FirstOrDefault(x => x.Name == gdi.EditFormItem.DataItem.ToString());
            if (ep != null)
            {
                gdi.ID = gdi.ID;
            }
        }
        tv.Rebind();
    }
}

TIA for any tips that lead me in the right direction. I hope my request is clear.

Follow-up: I just found these posts related to Entity Framework 4 and MVC that talk about the same way I want to use model-driven validation. http://stackoverflow.com/questions/4915957/using-system-componentmodel-dataannotations-with-entity-framework-4-0/ and http://ryanhayes.net/blog/data-annotations-for-entity-framework-4-entities-as-an-mvc-model/.

If this isn't a common request, it should be. If it isn't a planned feature for Telerik, it should be.

Marin
Telerik team
 answered on 11 Apr 2011
1 answer
62 views
Hi there

I'm unable to close a RadWindow in FireFox using an HTML image with onclick="Close();".  It works fine in all other browsers.

This is the javascript that I have on the page that's opening in the RadWindow:

 

 

 

<script language="javascript" type="text/javascript">
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow)
                oWindow = window.RadWindow; //Will work in Moz in all cases, including clasic dialog       
            else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow; //IE (and Moz as well)       
            return oWindow;
        }
  
        function Close() {
            GetRadWindow().Close();
        }           
</script>

 

 

I close the Radwindow using this code:

<img alt="Close Window"  src="closebutton.jpg" onclick="javascript:Close();" style="cursor: pointer" />

As I said, this works fine in all browsers except for FireFox.  I get a java error GetRadWindow() is undefined when I click the Close button in FireFox.

Just for information sake, this is my RadWindowManager code on the content page:
<telerik:RadWindowManager Width="620px" Height="495px" ReloadOnShow="true" 
       ShowContentDuringLoad="false" AutoSize="true" VisibleTitlebar="False" 
       VisibleStatusbar="false" Modal="true" ID="RadWindowManager1" runat="server">
   </telerik:RadWindowManager>

I invoke the RadWindow from the content page like this:
<img src="site/interface/quote.jpg" style="cursor: pointer" onclick="radopen('quote.aspx?p=<%=productname%>');" />

I've tried everything, hope someone here can help!  I'm using 2010 Q3 controls for ASP.NET Ajax in VB.NET.
Shinu
Top achievements
Rank 2
 answered on 11 Apr 2011
1 answer
137 views
Let's use Grid / Hierarchy with templates demo as example and let's say that I want to add image on contact information tab for all users that are older than 30 on the server side in RadGrid1_ItemCreated event:
      protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
      {
         if (e.Item is GridNestedViewItem)
         {
            GridNestedViewItem gnvItem = (GridNestedViewItem)e.Item;
            e.Item.FindControl("InnerContainer").Visible = gnvItem.ParentItem.Expanded;
         }

How I would find the dob data to check if current item person is older than ... 30?

Thanks
Princy
Top achievements
Rank 2
 answered on 11 Apr 2011
5 answers
93 views
Hi Experts,

I have a radGrid on my aspx page with some input controls. 
In radGrid i have 2 columns one is GridEditCommandColumn for editing record and other is GridButtonColumn for deleting record. I also placed radAjaxPanel and radAjaxLoading panel. All input controls and grid resides under raAjaxPanel.
When I click edit button from grid it populates all the input controls and grid gets disappear. Similarly when i click delete button from grid it makes an ajax call like edit button does and disappears the grid.

Can anyone please help me out.

Thanks,
Mohsin
Shinu
Top achievements
Rank 2
 answered on 11 Apr 2011
1 answer
252 views

Hello,

I'm having an issue posting values from a child window RadTextBox to the parent window RadTextBox. I can successfully post the value if I use an <input> tag on the parent page but when I swap it for a <asp:TextBox> or <telerik:RadTextBox> the javascript breaks with error "Microsoft JScript runtime error: 'valCity' is null or not an object. Take a look at the code below:

Parent Page:

 

 

 

 

function openDialog()
{
radDialog1 = radopen("DataMigration_Dialog1.aspx", "RadWindow1");
}
<telerik:RadButton ID="rb_Migrate" runat="server" Width="150px" 
Text="Migrate Accounts" EnableEmbeddedSkins="false" BackColor="#33393E" 
ForeColor="White" OnClientClicked="openDialog" AutoPostBack="false">
   
</telerik:RadButton>
   
<br />
</asp:Panel>
   
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableEmbeddedSkins="false" >
   
<Windows>
   
<telerik:RadWindow ID="RadWindow1" runat="server" Height="450" Width="240" Behaviors="Close, Minimize, Maximize, Reload" Modal="true" >
   
</telerik:RadWindow>
   
</Windows>
   
</telerik:RadWindowManager>
   
<asp:TextBox ID="City1" runat="server" ></asp:TextBox>
   
<%--<input type="text" id="City" value="Hide" runat="server" />--%>
<asp:TextBox ID="ParentCity" runat="server" ></asp:TextBox>
   
<asp:TextBox ID="TimeZone" runat="server" ></asp:TextBox>
   
<asp:TextBox ID="DMSVendor" runat="server" ></asp:TextBox>
   
<asp:TextBox ID="DMSUsername" runat="server" ></asp:TextBox>

Child Page:

function submit()
        {
            valCity = parent.document.getElementById("City1");
  
valCity.value = document.getElementById("modalCity1").value;
  
self.close();
               }
City:
    <br />
        <telerik:RadTextBox ID="modalCity1" runat="server" EnableEmbeddedSkins="false" Width="200">
        </telerik:RadTextBox>
  
  
<telerik:RadButton ID="RadButton1" runat="server" Text="Submit" 
            EnableEmbeddedSkins="false" Skin="WebBlue" ButtonType="StandardButton" 
            BackColor="#CCCCCC" OnClientClicked="submit" >
        </telerik:RadButton>

 

 

Shinu
Top achievements
Rank 2
 answered on 11 Apr 2011
1 answer
75 views
What is the best/easiest way to center items on a menu?  I've tried writing css to do it, but it never seems to work.

Thanks.
Shinu
Top achievements
Rank 2
 answered on 11 Apr 2011
1 answer
200 views
Hello,

I am attempting to get multiple column headers for the asp.net ajax RadGrid. 

Example:
                                        [            total2        ]
[Sub 1]  [Sub 2]  [Sub 3]  [Sub 4 [   Sub 2     ]

such as :http://blogs.telerik.com/pavelpavlov/posts/09-12-04/adding_additional_power_to_radgridview_for_silverlight_with_attached_behaviors.aspx

The Sub columns will be the data binder and the filters, it just need a spanning column above that.

Do you have any suggestions about this ?

Best regards.
Thank you.
Princy
Top achievements
Rank 2
 answered on 11 Apr 2011
2 answers
84 views
Hello,

How do i get the cell value of a RADGRID in a Grid event
 
Appreciate the help...
Thanks
Shinu
Top achievements
Rank 2
 answered on 11 Apr 2011
4 answers
93 views
So so so f*cking frustrated. New to ASP.NET and I can't get my head around the simplest concepts.

I have basic 'required' validators on fields - but when is the validation summary/error messages produced?

For example check this link (which is extremely similar to what I'm doing): http://www.aspxcode.net/free-asp-net-validation-source-code.aspx?Topics=How%20to%20Use%20ValidationSummary

When the button is clicked is when the validation "happens." But how? The code behind the button doesn't handle this!? 

I know this is not yet telerik-specific but once this question is answered I have another question regarding telerik-control specific validation (which may be solved depending on your explanation and my grasp of it).

Thanks a lot, any help and basic understanding here will be very much appreciated,

Dan
Veronica
Telerik team
 answered on 10 Apr 2011
3 answers
194 views
1).  Animations are available if I integrate this with JQuery?  Is there a walkthrough for how to install/implement this feature?

2).  Are there any good in-depth articles on Resources/Resource Types, what they are conceptually, how/why they're used, what scenarios are they used for.

3).  I've read through some articles on what the Scheduler can do, but just haven't found where to look to find how to do everything, and why, maybe an article explaining the architecture of the control and how to work with it in general.

4).  How would I customize the input of a new appointment.  For instance, I would want the user to be able to select from a drop down list of attendees from my database, he would be able to choose an attendee from a list.  Also, would be able to choose from another drop down list the reason for the appointment.  There may be some other data points as well, such as additional notes & description, in addition to the title and all other datapoints that come default with an appointment.  How would I go about implementing this functionality?  Do I add combo boxes to the insertTemplate, or the AdvancedInsertTemplate?  Are there any walkthroughs or demos for customizing this part?

5).  For instance, I see that there's an Appointment business object that represents each entry on the grid.  But this BO is fixed and doesn't have things like an ID for the user attending and an ID for the appointment reason (or whatever custom data we want to track). When we create a custom appointment with our custom template and the user chooses from these two drop-downs and the RadScheduler_AppointmentCreated event is fired it delivers an AppointmentCreatedEventArgs e that has an e.Appointment object that wouldn't tell us anything about these extra datapoints.  How do we get around this?

Thank you to anyone who is able to steer me in the right direction for any of these questions.
Veronica
Telerik team
 answered on 10 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?