Saturday, November 5, 2011

To apply client side validation on RadGrid Update or Insert button

Problem: To call any javascript(Client Side) on click of UpdateButton or InsertButton of RadGrid like this image,

Solution: Here is the code

Problem Using Telerik Project

Problem: When I up the website it is showing a strange behaviour, sometimes comboboxes are not working ,sometimes problem in RadGrid.It is running perfectly at local server.
Here is sample code,
<body>
    <form runat="server">
           <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
           <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
...........
           <telerik:RadGrid ID="RadGrid1" runat="server">
           </telerik:RadGrid>
...........
    </form>
</body>
Solution: It is because you are using RadScriptManager and it is conflicting with Telerik.StyleSheetManager.TelerikCdn.You can do EnableScriptCombine="false" and EnableHandlerDetection="false" (properties of RadScriptManager).
Here is sample code,
<body>
    <form runat="server">
           <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableScriptCombine="false" EnableHandlerDetection="false"></telerik:RadScriptManager>
           <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
...........
           <telerik:RadGrid ID="RadGrid1" runat="server">
           </telerik:RadGrid>
...........
    </form>
</body>

Friday, November 4, 2011

Client Side Validation of RadDatePicker

Problem: How to validate two RadDatePicker Controls for example "From Date" can
not be greater than "To Date".
Solution: It can be done by using asp validation controls like RequiredFieldValidator and CompareValidator. RequiredFieldValidator checks that whether value(date) is present or not. And CompareValidator compares the two values. Here is the sample code,

Tuesday, November 1, 2011

RadDatePicker enable/disable through javascript

Problem: How to enable/disable RadDatePicker through javascript ?
Solution: You can make use of the client side method set_enabled to false.

Example:
function disable()
  {
      var dateinput = $find("<%= RadDatePicker1.ClientID %>");
      dateinput.set_enabled(false);
  }

Also refer the following documentation for more on the RadDatePicker Client Object.
RadDatePicker Client Object

Monday, October 31, 2011

Load RadGrid on Click event

Problem: I Am Using Need data Source, For Binding Telerik Rad Grid,But  I don't Want To Load Rad Grid ,On Page Load Event,Because I want To Load Grid On Click_Button Event.

Solution: First you have to make your RadGrid Visible False on "PageLoad" Event.Then make Visible True on "Click" event of your button. Then Call Function Rebind() it will automatically call Need Data Source and Will Bind Your Rad Grid.

Example:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If IsPostBack = False Then
    'Enter The Code Just First Time When Page Is Load
    RadGrid1.visible=false       
    End If
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    RadGrid1.visible=True
    RadGrid1.rebind()
End Sub

Note: Need Data Source Function Is Necessary Here