Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
59 views
Hi,

We are using Telerik Rad AJAX  (2010 Q3) version 1.8.8   (RadJax.Net2 library).

If one webserver goes down, the ajax call may be sent before the load balancer realises a webserver has failed.  This results in the load balancer sometimes sending the ajax request to a now non-existent webserver.   

Obviously this results in a 404.

I have a handler for RadAjaxmanager OnRequestError event, which simply puts a JS Alwert on screen, and returns FALSE and this works.

Is there........

1. Any way we can handle this more gracefully - as any subsequent AJAX call seems to be ignored after the 404....
2. Automatically retry the AJAX call?

What is Teleriks (or any body elses) recommendation?

Thanks 
Konstantin Dikov
Telerik team
 answered on 02 Sep 2013
1 answer
59 views
I would like to do something like the following in a JavaScript method, but the "ExportSettings" object does not appear to exist in the client-side object model.  Is there a way that I can assign these properties via JavaScript?

gridEd.ExportSettings.ExportOnlyData = true;
gridEd.ExportSettings.IgnorePaging = true;
gridEd.ExportSettings.FileName = "WorkOrderListExport";
gridEd.ExportSettings.OpenInNewWindow = true;
Princy
Top achievements
Rank 2
 answered on 02 Sep 2013
3 answers
107 views
Hey There

I have a bit of a strange  problem, when i use an edit form popup with a radgrid and click the 'X' close button (top right) the popup nudges down but 5 or 6px, its like one of those annoying sites where you cannot close the popup?

This issue only happens in Chrome, i have tested it in both IE and FF and dont have any problem at all.

If anyone has come across this problem before, please could they advise?

Thanks
T
Angel Petrov
Telerik team
 answered on 02 Sep 2013
3 answers
196 views

I'm using Batch edit mode.  My insert command is very simple:
InsertCommand="INSERT INTO "WFM_CAT_RECURRENCE_DT" VALUES (:DIVISION, :DISTRICT, :LOCATION, :FROM_YEAR, :FROM_WEEK, :TO_YEAR, :TO_WEEK, :USERID, :USERNAME, SYSDATE)" but  it gives me an error:ORA-01036: illegal variable name/number.  Can anyone help?
My aspx is as follow:
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Copy_To_Maintenance.aspx.vb"
    Inherits="Copy_To_Maintenance" %>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" Runat="Server">

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
   
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"
            CellSpacing="0" DataSourceID="OracleDatabase1" GridLines="None"
            AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
            AllowAutomaticUpdates="True" AutoGenerateColumns="False"
            AllowFilteringByColumn="True" Width="1250px">
            <mastertableview
                datakeynames="USERID,USERNAME,CREATE_DATE"
                datasourceid="OracleDatabase1" commanditemdisplay="TopAndBottom"
                EditMode="Batch" BatchEditingSettings-EditType="Cell"
                autogeneratecolumns="False" >
                <RowIndicatorColumn Visible="False">
                </RowIndicatorColumn>
                <ExpandCollapseColumn Created="True">
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="DIVISION"
                        FilterControlAltText="Filter DIVISION column" HeaderText="DIVISION"
                        ReadOnly="False" SortExpression="DIVISION" UniqueName="DIVISION" AllowFiltering="True">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="DISTRICT"
                        FilterControlAltText="Filter DISTRICT column" HeaderText="DISTRICT"
                        SortExpression="DISTRICT" UniqueName="DISTRICT" ReadOnly="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="LOCATION"
                        FilterControlAltText="Filter LOCATION column" HeaderText="LOCATION"
                        SortExpression="LOCATION" UniqueName="LOCATION" ReadOnly="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FROM_YEAR" DataType="System.Decimal"
                        FilterControlAltText="Filter FROM_YEAR column" HeaderText="FROM_YEAR"
                        SortExpression="FROM_YEAR" UniqueName="FROM_YEAR">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FROM_WEEK" DataType="System.Decimal"
                        FilterControlAltText="Filter FROM_WEEK column" HeaderText="FROM_WEEK"
                        SortExpression="FROM_WEEK" UniqueName="FROM_WEEK">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="TO_YEAR" DataType="System.Decimal"
                        FilterControlAltText="Filter TO_YEAR column" HeaderText="TO_YEAR"
                        SortExpression="TO_YEAR" UniqueName="TO_YEAR">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="TO_WEEK" DataType="System.Decimal"
                        FilterControlAltText="Filter TO_WEEK column" HeaderText="TO_WEEK"
                        SortExpression="TO_WEEK" UniqueName="TO_WEEK">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="USERID"
                        FilterControlAltText="Filter USERID column" HeaderText="USERID"
                        SortExpression="USERID" UniqueName="USERID" ReadOnly="True">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="USERNAME"
                        FilterControlAltText="Filter USERNAME column" HeaderText="USERNAME"
                        SortExpression="USERNAME" UniqueName="USERNAME" ReadOnly="True">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CREATE_DATE" DataType="System.DateTime"
                        FilterControlAltText="Filter CREATE_DATE column" HeaderText="CREATE_DATE"
                        SortExpression="CREATE_DATE" UniqueName="CREATE_DATE" ReadOnly="True">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" />
                </Columns>
            </mastertableview>
           
        </telerik:RadGrid>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        </telerik:RadWindowManager>
   
    <asp:SqlDataSource ID="OracleDatabase1" runat="server"
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            DeleteCommand="DELETE FROM &quot;WFM_CAT_RECURRENCE_DT&quot; WHERE &quot;DIVISION&quot; = :DIVISION AND &quot;DISTRICT&quot; = :DISTRICT AND &quot;LOCATION&quot; = :LOCATION AND &quot;FROM_YEAR&quot; = :FROM_YEAR AND &quot;FROM_WEEK&quot; = :FROM_WEEK AND &quot;TO_YEAR&quot; = :TO_YEAR AND &quot;TO_WEEK&quot; = :TO_WEEK AND &quot;USERID&quot; = :USERID AND &quot;USERNAME&quot; = :USERNAME AND &quot;CREATE_DATE&quot; = :CREATE_DATE"
            InsertCommand="INSERT INTO &quot;WFM_CAT_RECURRENCE_DT&quot; VALUES (:DIVISION, :DISTRICT, :LOCATION, :FROM_YEAR, :FROM_WEEK, :TO_YEAR, :TO_WEEK, :USERID, :USERNAME, SYSDATE)"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
            SelectCommand="SELECT &quot;DIVISION&quot;, &quot;DISTRICT&quot;, &quot;LOCATION&quot;, &quot;FROM_YEAR&quot;, &quot;FROM_WEEK&quot;, &quot;TO_YEAR&quot;, &quot;TO_WEEK&quot;, &quot;USERID&quot;, &quot;USERNAME&quot;, &quot;CREATE_DATE&quot; FROM &quot;WFM_CAT_RECURRENCE_DT&quot;"
           
            UpdateCommand="UPDATE &quot;WFM_CAT_RECURRENCE_DT&quot; SET &quot;LOCATION&quot; = :LOCATION, &quot;FROM_YEAR&quot; = :FROM_YEAR, &quot;FROM_WEEK&quot; = :FROM_WEEK, &quot;TO_YEAR&quot; = :TO_YEAR, &quot;TO_WEEK&quot; = :TO_WEEK, &quot;USERID&quot; = 'ID', &quot;USERNAME&quot; = 'NAME', &quot;CREATE_DATE&quot; = SYSDATE WHERE &quot;DIVISION&quot; = :DIVISION AND &quot;DISTRICT&quot; = :DISTRICT AND &quot;LOCATION&quot; = :LOCATION AND &quot;USERID&quot; = :USERID AND &quot;USERNAME&quot; = :USERNAME AND &quot;CREATE_DATE&quot; = :CREATE_DATE">

            <DeleteParameters>
                <asp:Parameter Name="DIVISION" Type="String" />
                <asp:Parameter Name="DISTRICT" Type="String" />
                <asp:Parameter Name="LOCATION" Type="String" />
                <asp:Parameter Name="FROM_YEAR" Type="Decimal" />
                <asp:Parameter Name="FROM_WEEK" Type="Decimal" />
                <asp:Parameter Name="TO_YEAR" Type="Decimal" />
                <asp:Parameter Name="TO_WEEK" Type="Decimal" />
                <asp:Parameter Name="USERID" Type="String" />
                <asp:Parameter Name="USERNAME" Type="String" />
                <asp:Parameter Name="CREATE_DATE" Type="DateTime" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="DIVISION" Type="String" />
                <asp:Parameter Name="DISTRICT" Type="String" />
                <asp:Parameter Name="LOCATION" Type="String" />
                <asp:Parameter Name="FROM_YEAR" Type="Decimal" />
                <asp:Parameter Name="FROM_WEEK" Type="Decimal" />
                <asp:Parameter Name="TO_YEAR" Type="Decimal" />
                <asp:Parameter Name="TO_WEEK" Type="Decimal" />
                <asp:Parameter Name="USERID" Type="String" />
                <asp:Parameter Name="USERNAME" Type="String" />
                <asp:Parameter Name="CREATE_DATE" Type="DateTime" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="DIVISION" Type="String" />
                <asp:Parameter Name="DISTRICT" Type="String" />
                <asp:Parameter Name="LOCATION" Type="String" />
                <asp:Parameter Name="FROM_YEAR" Type="Decimal" />
                <asp:Parameter Name="FROM_WEEK" Type="Decimal" />
                <asp:Parameter Name="TO_YEAR" Type="Decimal" />
                <asp:Parameter Name="TO_WEEK" Type="Decimal" />
                <asp:Parameter Name="USERID" Type="String" />
                <asp:Parameter Name="USERNAME" Type="String" />
                <asp:Parameter Name="CREATE_DATE" Type="DateTime" />
            </InsertParameters>
        </asp:SqlDataSource>
</asp:Content>

 

 

 

 

 

 

 

Angel Petrov
Telerik team
 answered on 02 Sep 2013
1 answer
108 views
   
   Hi,

            How do I show context menu on clicking gridbuttoncolumn. Can anybody help??

  thanks.
  Savyo
Princy
Top achievements
Rank 2
 answered on 02 Sep 2013
5 answers
293 views
Hello All

I have a RadTreeList in my page and I have requirement to expand all the levels of the list.

I have searched a lot and found method of tree list ExpandAll() and collepseAll() but not working on my case.

So is there any way to do this or is there any way to do it manually?

thanks

Hardik
Shinu
Top achievements
Rank 2
 answered on 02 Sep 2013
1 answer
101 views
how to get co-ordinate position of image in rad button ?? pls reply....
In image button we use int x = e.x  and int y = e.y method...
Ianko
Telerik team
 answered on 02 Sep 2013
17 answers
359 views
HI all anybodu knows how to put a rad grid at full size in vertical?

Best regards.

Carlos
Top achievements
Rank 1
 answered on 02 Sep 2013
1 answer
492 views

We have customized the physical location as well as file download behavior by using the sample code files 'CustomFileSystemProvider.cs' and 'FileSystemHandler.ashx'. The implementation works fine on developer machine, but getting 404 error on production server.
=========================================================================================================
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
--------------------------------------------------------------------------------

Please try the following:
•Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
•If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
•Click the Back button to try another link.

HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)

--------------------------------------------------------------------------------

Technical Information (for support personnel)
•Go to Microsoft Product Support Services and perform a title search for the words HTTP and 404.
•Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Web Site Setup, Common Administrative Tasks, and About Custom Error Messages.
=========================================================================================================
Is that some configuration related to .ashx is missing on the server or what could be the issue.  Please suggest.

Thanks,

Suresh.C

Vessy
Telerik team
 answered on 02 Sep 2013
4 answers
467 views
i had put a dropdownlist in formtemplate for user to select value.
but how can i assign the selected value from db to the dropdownlist ?

           <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function RowDblClick(sender, eventArgs) {
                    sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
                }
            </script>
        </telerik:RadCodeBlock>
 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid_License">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid_License" LoadingPanelID="RadAjaxLoadingPanel1">
                        </telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="divMsgs"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
            <telerik:RadGrid ID="RadGrid_License" runat="server" CellSpacing="0"
            DataSourceID="ODS_License" GridLines="None" style="margin-top: 0px"
            AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" ShowStatusBar="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
            AllowAutomaticUpdates="True">
                <MasterTableView AutoGenerateColumns="False"
                    DataKeyNames="License_To_Operate_ID" DataSourceID="ODS_License"
                    AllowFilteringByColumn="False" AllowPaging="False"
                    CommandItemDisplay="Top">
 
                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"
                        Visible="True">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"
                        Visible="True">
                    </ExpandCollapseColumn>
 
                    <Columns>
                                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
                        </telerik:GridEditCommandColumn>
                        <telerik:GridBoundColumn DataField="License_To_Operate_ID"
                            FilterControlAltText="Filter License_Number column" HeaderText="License_To_Operate_ID"
                            SortExpression="License_To_Operate_ID" UniqueName="License_To_Operate_ID" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="License_Name"
                            FilterControlAltText="Filter License_Name column" HeaderText="License Name"
                            SortExpression="License_Name" UniqueName="License_Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="License_Number"
                            FilterControlAltText="Filter License_Number column" HeaderText="License Number"
                            SortExpression="License_Number" UniqueName="License_Number">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="License_Issuer"
                            FilterControlAltText="Filter License_Issuer column" HeaderText="License Issuer"
                            SortExpression="License_Issuer" UniqueName="License_Issuer">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Valid_From" DataType="System.DateTime"
                            FilterControlAltText="Filter Valid_From column" HeaderText="Valid From"
                            SortExpression="Valid_From" UniqueName="Valid_From" DataFormatString="{0: dd-MMM-yyyy}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Valid_Till" DataType="System.DateTime"
                            FilterControlAltText="Filter Valid_Till column" HeaderText="Valid Till"
                            SortExpression="Valid_Till" UniqueName="Valid_Till" DataFormatString="{0: dd-MMM-yyyy}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Issue_date" DataType="System.DateTime"
                            FilterControlAltText="Filter Issue_date column" HeaderText="Issue Date"
                            SortExpression="Issue_date" UniqueName="Issue_date" DataFormatString="{0: dd-MMM-yyyy}">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <EditFormSettings EditFormType="Template">
                        <EditColumn FilterControlAltText="Filter EditCommandColumn1 column"
                            UniqueName="EditCommandColumn1">
                        </EditColumn>
    <FormTemplate>
 
        <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none"
            style="border-collapse: collapse;">
            <tr class="EditFormHeader">
            <td style="width:100px">
            <asp:Label ID="Label5" Text="License Type" runat="server"></asp:Label>                                                           
            </td>
            <td>
                <telerik:RadDropDownList ID="rdl_license_type" runat="server" DataSourceID="LDS_License_type" DefaultMessage="Please select..."
                 DataValueField="License_ID" DataTextField="License_name" >
                </telerik:RadDropDownList>  
                <asp:Label ID="Lb_License_ID" runat="server" text='<%# Bind("License_ID") %>'></asp:Label>
     
            </td>
            </tr>
            <tr >
            <td >
            <asp:Label ID="lb" Text="License Number" runat="server"></asp:Label>                                                           
            </td>
            <td>
            <asp:TextBox ID="tb_License_Number" runat="server" Text='<%# Bind("License_Number") %>' TabIndex="2"></asp:TextBox>                                                           
            </td>
            </tr>
            <tr>
            <td>
            <asp:Label ID="Label1" Text="License Issuer" runat="server"></asp:Label>
            </td>
            <td>
            <asp:TextBox ID="tb_License_Issuer" runat="server" Text='<%# Bind("License_Issuer") %>' TabIndex="3"></asp:TextBox>
            </td>
            </tr>
            <tr>
            <td>
            <asp:Label ID="Label2" Text="Issue Date" runat="server"></asp:Label>
            </td>
            <td>
            <telerik:RadDatePicker ID="IssueDatePicker" runat="server" MinDate="1/1/1900" DbSelectedDate='<%# Bind("Issue_Date") %>' TabIndex="4"></telerik:RadDatePicker>
            </td>
            </tr>
            <tr>
            <td>
            <asp:Label ID="Label3" Text="Valid From" runat="server"></asp:Label>
            </td>
            <td>
            <telerik:RadDatePicker ID="RadDatePicker_ValidFrom" runat="server" MinDate="1/1/1900" DbSelectedDate='<%# Bind("Valid_From") %>' TabIndex="5"></telerik:RadDatePicker>
            </td>
            </tr>
                                                                        <tr>
            <td>
            <asp:Label ID="Label4" Text="Valid To" runat="server"></asp:Label>
            </td>
            <td>
            <telerik:RadDatePicker ID="RadDatePicker_ValidTill" runat="server" MinDate="1/1/1900" DbSelectedDate='<%# Bind("Valid_Till") %>' TabIndex="6"></telerik:RadDatePicker>
            </td>
            </tr>
 
               <tr>
                <td align="right" colspan="2">
                    <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                        runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' >
                    </asp:Button
                    <asp:Button ID="btnDelete" Text="Delete" runat="server" CausesValidation="False"
                        CommandName="Delete"></asp:Button>
                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                        CommandName="Cancel"></asp:Button>
 
                </td>
            </tr>
        </table>
    </FormTemplate>
</EditFormSettings>
                    <PagerStyle PageSizeControlType="RadComboBox" />
                </MasterTableView>
                <PagerStyle PageSizeControlType="RadComboBox" />
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
 
        </telerik:RadGrid>
        <asp:LinqDataSource ID="LDS_License_type" runat="server"
            ContextTypeName="dcLRDBDataContext" EntityTypeName=""
            TableName="db_Dictionary_Licenses">
            </asp:LinqDataSource>
        <asp:ObjectDataSource ID="ODS_License" runat="server"
            SelectMethod="GetLicenseArrayByUserID" TypeName="LRDB">
            <SelectParameters>
                <asp:SessionParameter DefaultValue="0" Name="id" SessionField="SelectedUserID"
                    Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:LinqDataSource ID="LDS_License" runat="server"
            ContextTypeName="dcLRDBDataContext" EntityTypeName=""
            TableName="db_Employee_Licenses" Where="UserID == @UserID">
            <WhereParameters>
                <asp:SessionParameter Name="UserID" SessionField="SelectedUserID"
                    Type="Int32" DefaultValue="0"/>
            </WhereParameters>
        </asp:LinqDataSource>

VB code behind

Protected Sub RadGrid_License_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid_License.ItemCommand
 
 
     If e.CommandName = RadGrid.InitInsertCommandName Then   'Click Add New Record button           
         Dim editColumn As GridEditCommandColumn = CType(RadGrid_License.MasterTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn)
         editColumn.Visible = False
     ElseIf (e.CommandName = RadGrid.RebindGridCommandName AndAlso e.Item.OwnerTableView.IsItemInserted) Then
         e.Canceled = True
     Else
         Dim editColumn As GridEditCommandColumn = CType(RadGrid_License.MasterTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn)
         If Not editColumn.Visible Then  'Click Cancel button (both Insert and Update mode)
             editColumn.Visible = True
         End If
 
         Dim ddlLicense_id As RadDropDownList = DirectCast(e.Item.FindControl("rdl_license_type"), RadDropDownList)
         Dim txtLicense_Number As TextBox = DirectCast(e.Item.FindControl("tb_License_Number"), TextBox)
         Dim txtLicense_Issuer As TextBox = DirectCast(e.Item.FindControl("tb_License_Issuer"), TextBox)
         Dim dateIssue As RadDatePicker = DirectCast(e.Item.FindControl("IssueDatePicker"), RadDatePicker)
         Dim dateValidFrom As RadDatePicker = DirectCast(e.Item.FindControl("RadDatePicker_ValidFrom"), RadDatePicker)
         Dim dateValidTill As RadDatePicker = DirectCast(e.Item.FindControl("RadDatePicker_ValidTill"), RadDatePicker)
         Dim dc As New dcLRDBDataContext
         If e.CommandName = "PerformInsert" Then
 
             If Request.QueryString("EmployeeID") = "" Then  'New Employee
                 Dim rnd As New Random()
                 Dim tmpUserID As Integer 'allow 10 digit only
                 tmpUserID = rnd.Next(100000, 999999) & DateTime.Now.Hour & DateTime.Now.Minute
                 HttpContext.Current.Session("tmpUserID") = tmpUserID
 
                 dc.insertEmployeeLicense(tmpUserID.ToString, ddlLicense_id.SelectedValue, txtLicense_Number.Text.Trim, txtLicense_Issuer.Text.Trim, _
                                            dateIssue.SelectedDate, dateValidFrom.SelectedDate, dateValidTill.SelectedDate, "Y", DateTime.Now, HttpContext.Current.Session("UserID").ToString)
 
             Else
                 dc.insertEmployeeLicense(Request.QueryString("EmployeeID").ToString, ddlLicense_id.SelectedValue, txtLicense_Number.Text.Trim, txtLicense_Issuer.Text.Trim, _
                                            dateIssue.SelectedDate, dateValidFrom.SelectedDate, dateValidTill.SelectedDate, "Y", DateTime.Now, HttpContext.Current.Session("UserID").ToString)
             End If
 
         ElseIf e.CommandName = "Update" Then
             Dim lid As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("License_To_Operate_ID")
             Dim uid As Integer
             If Request.QueryString("EmployeeID") = "" Then
                 uid = HttpContext.Current.Session("tmpUserID").ToString
             Else
                 uid = GetUserIDbyEmployeeID(Request.QueryString("EmployeeID")).ToString
             End If
 
             Dim rec = (From p In dc.db_Employee_Licenses Where p.UserID = uid And p.License_To_Operate_ID = lid).FirstOrDefault
             If Not rec Is Nothing Then
                 rec.License_ID = ddlLicense_id.SelectedValue
                 rec.License_Number = txtLicense_Number.Text.Trim
                 rec.License_Issuer = txtLicense_Issuer.Text.Trim
                 rec.Issue_date = dateIssue.SelectedDate
                 rec.Valid_From = dateValidFrom.SelectedDate
                 rec.Valid_Till = dateValidTill.SelectedDate
             End If
         ElseIf e.CommandName = "Delete" Then
             Dim lid As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("License_To_Operate_ID")
             Dim uid As Integer
             If Request.QueryString("EmployeeID") = "" Then
                 uid = HttpContext.Current.Session("tmpUserID").ToString
             Else
                 uid = GetUserIDbyEmployeeID(Request.QueryString("EmployeeID")).ToString
             End If
             Dim rec2 = (From p In dc.db_Employee_Licenses Where p.UserID = uid And p.License_To_Operate_ID = lid).FirstOrDefault
             If Not IsNothing(rec2) Then
                 dc.db_Employee_Licenses.DeleteOnSubmit(rec2)
                 dc.SubmitChanges()
             End If
         End If
             dc.Dispose()
     End If
 End Sub
 Private Sub RadGrid_License_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid_License.ItemDataBound
     If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then
         Dim item As GridEditableItem = e.Item
         'access/modify the edit item template settings here
         Dim list As RadDropDownList = item.FindControl("rdl_license_type")
         'list.DataSource = Country_values
         'list.DataBind()
         If (Not HttpContext.Current.Session("updatedValue") Is Nothing) Then
             list.SelectedValue = 2
             'HttpContext.Current.Session("updatedValue")
         End If
     ElseIf (TypeOf e.Item Is GridDataItem AndAlso Not e.Item.IsInEditMode AndAlso Page.IsPostBack) Then
         Dim item As GridDataItem = e.Item
         Dim label As Label = item.FindControl("Lb_License_ID")
 
         'update the label value
         label.Text = HttpContext.Current.Session("updatedValue")
     End If
 End Sub








Princy
Top achievements
Rank 2
 answered on 02 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?