Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
101 views
Hi
I want change font of

AddNewRecordText for my grid
what do?

Salman
Top achievements
Rank 1
 answered on 19 Mar 2011
3 answers
233 views
I'm following the examples to perform a batch update in a radgrid.

However, the HashTable contains the old value for the RadNumericTextBox. I want whatever the user has just typed in. I have some client-side script that format the numbers.

How can I get the most recent value that the user typed in as the qty value?

Here's the template column markup:

<telerik:GridTemplateColumn DataField="Qty" DataType="System.Decimal" HeaderText="Qty"
    SortExpression="Qty" UniqueName="Qty">
    <EditItemTemplate>
        <telerik:RadNumericTextBox Width="40px" MinValue="0" MaxValue="9999999.99" Type="Number"
            ID="QtyTextBox" Text='<%# Bind("Qty") %>' InvalidStyleDuration="1000" NumberFormat-DecimalDigits="2"
            runat="server" MaxLength="20">
            <ClientEvents OnLoad="RemoveZeros" OnBlur="RemoveZeros" OnValueChanged="RemoveZeros" />
        </telerik:RadNumericTextBox>
        <asp:RangeValidator ID="rngQty" runat="server" ControlToValidate="QtyTextBox" ErrorMessage="<br />Must be a number"
            Display="Dynamic" MinimumValue="0" MaximumValue="999999999" Type="Double"></asp:RangeValidator>
        <asp:RequiredFieldValidator ID="reqQty" ControlToValidate="QtyTextBox" runat="server"
            Display="Dynamic" ErrorMessage="<br />A quantity is required."></asp:RequiredFieldValidator>
    </EditItemTemplate>
    <ItemTemplate>
        <asp:Label ID="QtyLabel" runat="server" Text='<%# FormatDecimalWithoutUnusedDecimals( Eval("Qty")) %>'></asp:Label>
    </ItemTemplate>
    <ItemStyle Width="55px" />
    <HeaderStyle Width="55px" />
    <FooterStyle HorizontalAlign="Right" />
    <FooterTemplate>
    </FooterTemplate>
</telerik:GridTemplateColumn>

Here's the code:

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, _
              ByVal e As Telerik.Web.UI.GridCommandEventArgs) _
              Handles RadGrid1.ItemCommand
    Dim newValues As New Hashtable
    If e.CommandName = "UpdateAll" Then
        UpdateShipment(Nothing, Nothing)
        For Each editedItem As GridEditableItem In RadGrid1.EditItems
            e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)
            Dim QtyTextBox As RadNumericTextBox
            QtyTextBox = CType(editedItem("Qty").FindControl("QtyTextBox"), RadNumericTextBox)
            UpdateRowValue(newValues)
        Next
        RadGrid1.EditIndexes.Clear()
        RadGrid1.Rebind()
    End If
End Sub

Here's the Javascript:

function RemoveZeros(sender, args) {
    var tbValue = sender._textBoxElement.value;
    if (tbValue.indexOf(".00") != -1)
        sender._textBoxElement.value = tbValue.substr(0, tbValue.indexOf(".00"));
}
Veli
Telerik team
 answered on 19 Mar 2011
8 answers
1.0K+ views
I use the RadMenu and it works fine on my pc. When I move the project to the web server, I get the following error:


Could not load file or assembly 'Telerik.Web.Design, Version=2010.1.309.35,Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies.The system cannot find the file specified

What am I missing? 

Appreciate your help
Le Duc Hieu
Top achievements
Rank 2
 answered on 19 Mar 2011
2 answers
74 views
hi,

i am using a RadEditor in a Multipage with Tab control, located in a radwindow.
in IE8 there is a strange behaviour, that when you are typing, the cursor jumps to the first position of the editor and no text is displayed. when you switch to another tab, after switching back to the editor, the typed text is displayed.
it works properly in compatibility mode and in firefox.
there is a workaround, using a

<

 

meta http-equiv="X-UA-Compatible" content="IE=7" />  tag on the page, but thats not really an acceptable solution.

thanks for any suggestions.

peter

 

Carrie
Top achievements
Rank 1
 answered on 18 Mar 2011
0 answers
58 views
Hi Guys,
I'm not sure anybody have had this issue.
Using Popup Edit Form in RadGrid with CheckBoxList ,I want for all those selected CheckBoxes in CheckBoxlist (for each one)Run a Strored procedure which has been binded to ObjectDataSource.
I don't know how???
Thanks,
:)
Mahmood
Top achievements
Rank 1
 asked on 18 Mar 2011
5 answers
146 views
Hi All,

I have created a custom template which contains a checkbox and a label for the RadComboBox multi select capability. When I enable AutomaticLoadOnDemand property to true, for the first request the markup is generated for first 10 items and for consecutive requests the checkbox client id's are same as the checkboxes that were requested for the first time. Is there anyway I can maintain the different id's for checkbox controls?

Thanks in advance!!!
Mammu
Top achievements
Rank 1
 answered on 18 Mar 2011
0 answers
78 views
I have accomplished this many times before. For some reason I just can't get this working. The main difference is that I am binding the grid from a datatable and not a sqldatasource. Can someone look at this with fresh eyes? Thanks.

Parent Page ASPX:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="user_lookup_site.aspx.vb" Inherits="_Default" %>
  
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title>Aeries Global System Manager</title>
<link rel="stylesheet" type="text/css" href="~/includes/ITC_Main.css" /> 
  
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function refreshGrid(arg) {
                if (!arg) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }
                else {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
                }
            }
  
        </script>
  
  
        </telerik:RadCodeBlock>
  
</head>
<body>
    <form id="form1" runat="server">
    <div id="header">
  
        <table cellpadding="0" cellspacing="0" style="width: 100%; height: 40px;">
            <tr>
                <td style="width: 200px; vertical-align: middle; text-align: center;">
                    <img alt="" src="../../images/aalogo.gif" style="width: 169px; height: 35px" /></td>
                <td style="text-align: center;">
  
  
  
                    <datelbl:ShowDate ID="ShowDate1" runat="server" />
                </td>
                <td style="width: 300px; text-align: center;">
  
  
  
                                        <table cellpadding="2" cellspacing="0" 
                          
                        style="width: 292px; height: 40px; background-image: url('../../images/headerinset.gif'); text-align: center;">
                        <tr>
                            <td style="font-weight: bold; font-size: small; font-family: Arial, Helvetica, sans-serif; color: #00B000; text-align: center;">
                                Logged in as: 
                                <asp:LoginName ID="LoginName1" runat="server" Font-Names="Arial" 
                                    Font-Size="Small" ForeColor="#597791" 
                                    meta:resourcekey="LoginName1Resource1" />
                                     
                                <asp:LoginStatus ID="LoginStatus1" runat="server" CssClass="login" 
                                    meta:resourcekey="LoginStatus1Resource1" />
                            </td>
                        </tr>
                    </table></td>
                <td style="text-align: center; vertical-align: middle; width: 175px;">
                    <img alt="" src="../../images/aatusdlogo.gif" style="width: 152px; height: 36px" /></td>
            </tr>
        </table>
  
    </div>
        <div id="subheader">
  
    </div>
            <div>
        <table cellpadding="0" cellspacing="0" style="width: 100%">
            <tr>
                <td style="width: 250px; background-image: url('../../images/menuback.gif'); background-color: #E6E6E6; border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #000000;" 
                    valign="top">
                    <telerik:RadPanelBar ID="rpb_AA_Menu" Runat="server" DataFieldID="DataFieldID" 
                        DataFieldParentID="DataFieldParentID" 
                        DataNavigateUrlField="DataNavigateUrlField" DataSourceID="sds_AA_Menu" 
                        DataTextField="DataTextField" DataValueField="DataTextField" Width="250px" 
                        PersistStateInCookie="True" Skin="Office2007">
                        <DataBindings>
                            <telerik:RadPanelItemBinding SelectedImageUrlField="ImageURL" 
                                ExpandedImageUrlField="ImageURL" HoveredImageUrlField="ImageURL" 
                                ImageUrlField="ImageURL" />
                            <telerik:RadPanelItemBinding ImageUrlField="ImageURL" />
                        </DataBindings>
                    </telerik:RadPanelBar>
                      
                </td>
                <td valign="top" 
                    style="background-color: #FFFFFF; border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #000000;">
                    <table cellpadding="0" cellspacing="0" style="width: 100%">
                        <tr>
                            <td style="padding: 10px">
     <h1>
                    ABI
                    User Manager - User Lookup by Site</h1>
                                <h2>
                                    Database</h2>
                                            <telerik:RadComboBox ID="rcb_Database" Runat="server" 
                                                DataSourceID="sds_Database" DataTextField="DatabaseName" 
                                                DataValueField="DatabaseName" AppendDataBoundItems="True">
                                                <Items>
                                                    <telerik:RadComboBoxItem Value = "" Text="Select" />
                                                </Items>                                            
                                                </telerik:RadComboBox>
                                        <h2>
                                            Site </h2>
                                            <telerik:RadComboBox ID="rcb_Site" Runat="server" 
                                                DataSourceID="sds_Site" DataTextField="Name" 
                                                DataValueField="IDSite" AppendDataBoundItems="True" 
                                                AutoPostBack="True" Height="300px" Width="250px">
                                                <Items>
                                                    <telerik:RadComboBoxItem Value = "" Text="Select"  />
                                                </Items>                                            
                                                </telerik:RadComboBox>
                                        <table cellpadding="0" cellspacing="0" style="width: 100%">
                                            <tr>
                                                <td>
                                                     </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                     </td>
                                            </tr>
                                </table>
<telerik:RadGrid ID="rgd_ABIUser" runat="server"  GridLines="None" AutoGenerateColumns="False" Width="700px">
    <MasterTableView DataKeyNames="ID">
        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
        <RowIndicatorColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="SC" HeaderText="Site" 
                    SortExpression="SC" UniqueName="SC" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ID" HeaderText="User" 
                    SortExpression="ID" UniqueName="ID"  HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="175px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PW" HeaderText="Password" 
                    SortExpression="PW" UniqueName="PW"  HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="175px">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SN" HeaderText="TCH#" 
                    SortExpression="SN" UniqueName="SN" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="TG" HeaderText="Group" 
                    SortExpression="TG" UniqueName="TG" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="TemplateColumn">
                    <ItemTemplate
                    <asp:Button ID="btn_ModifyPerms" runat="server" Text="Modify" onclick="btn_ModifyABIUser_Click" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
    </MasterTableView>
</telerik:RadGrid>
  
  
   
                                <p>
                                     </p>
                                <p>
                                     </p>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
            <div id="footer">
  
    </div>
  
  
                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rgd_ABIUser" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rgd_ABIUser">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rgd_ABIUser" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
  
  
  
  
        <asp:SqlDataSource ID="sds_AA_Menu" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AeriesAdmin_ConnectionString %>" 
        SelectCommand="SELECT [DataFieldID], [DataFieldParentID], [DataTextField], [DataNavigateUrlField], [ImageURL], [UserLevel] FROM [AA_Menu] WHERE ([UserLevel] LIKE '%' + @UserLevel + '%')">
            <SelectParameters>
                <asp:SessionParameter Name="UserLevel" SessionField="RoleName" Type="String" />
            </SelectParameters>
    </asp:SqlDataSource>
      
    <telerik:RadScriptManager ID="rsm_AeriesAdmin" Runat="server">
    </telerik:RadScriptManager>
    <telerik:RadFormDecorator ID="rfd_AeriesAdmin" Runat="server" Skin="WebBlue" />
      
  
    <asp:SqlDataSource ID="sds_Database" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AeriesAdmin_ConnectionString %>" 
        SelectCommand="SELECT DISTINCT [DatabaseName] FROM [vw_AA_Databases] ORDER BY [DatabaseName]"></asp:SqlDataSource>
  
  
    <asp:SqlDataSource ID="sds_Site" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AeriesAdmin_ConnectionString %>" 
        SelectCommand="SELECT [IDSite], [Name] FROM [vw_ITC_Sites] ORDER BY [Name]">
    </asp:SqlDataSource>
  
  
    <br />
  
  
    <br />
      
    </form>
      
    </body>
</html>

Parent Page VB

Imports System.Data
Imports System.Data.SqlClient
Imports Telerik.Web.UI
Imports System.CodeDom
Imports System.Web
Imports System.Web.Security
Imports System.Web.Security.Roles
Imports System.Web.Security.Membership
Imports System.Security
Imports System.Security.Principal.WindowsIdentity
Imports System.Drawing
Imports System.Threading
Partial Class _Default
    Inherits System.Web.UI.Page
  
  
    'Protected Sub RadPanelBar1_DataBound1(ByVal sender As Object, ByVal e As System.EventArgs) Handles rpb_AA_Menu.DataBound
    '    rpb_AA_Menu.Items(0).Expanded = True
    '    rpb_AA_Menu.Items(1).Expanded = True
    'End Sub
  
  
    'Protected Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreLoad
  
    '    Dim ActiveDirID As String = "ActiveDirID"
    '    Dim connectionString As String = DirectCast(ConfigurationManager.ConnectionStrings("AeriesAdmin_ConnectionString").ConnectionString, String)
    '    Dim queryString As String = "SELECT ActiveDirID, RoleName, FullName, UserName FROM vw_ADSI WHERE UserName = @UserName"
  
    '    Using myConnection As New SqlConnection(connectionString)
    '        Dim myCommand As New SqlCommand(queryString, myConnection)
    '        myConnection.Open()
    '        myCommand.Parameters.AddWithValue("@UserName", User.Identity.Name)
    '        Dim MyReader As SqlDataReader = myCommand.ExecuteReader
    '        MyReader.Read()
    '        Session("UserName") = MyReader("UserName")
    '        Session("ActiveDirID") = MyReader("ActiveDirID")
    '        Session("RoleName") = MyReader("RoleName")
    '        myConnection.Close()
    '    End Using
  
  
    ' End Sub
  
    '**********************************************************************
    'Format combo boxes
    '**********************************************************************
  
  
  
    Protected Sub rcb_Site_SelectedIndexChanged(o As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcb_Site.SelectedIndexChanged
  
        rgd_ABIUser.DataSource = GetUser()
        rgd_ABIUser.DataBind()
  
    End Sub
  
    Private Function GetUser() As DataTable
  
        Dim DatabaseName As String = rcb_Database.SelectedValue
        Dim SC As String = rcb_Site.SelectedValue
  
        Dim connectionString = New SqlConnection("server=DO-IT-AB\MSSQLAB;database=AeriesAdmin;UID=XXX;PWD=XXX;")
        Dim command = New SqlCommand("aa_abi_users_by_site", connectionString)
  
        command.CommandType = CommandType.StoredProcedure
  
        command.Parameters.Add("@DBName", SqlDbType.VarChar).Value = DatabaseName
        command.Parameters.Add("@SC", SqlDbType.VarChar).Value = SC
  
        command.Connection.Open()
  
        Dim myDataAdapter As New SqlDataAdapter(command)
        Dim myDataSet As New DataSet
        Dim dtData As New DataTable
        myDataAdapter.Fill(myDataSet)
        Return myDataSet.Tables(0)
  
        command.Connection.Close()
  
    End Function
  
  
    Protected Sub btn_ModifyABIUser_Click(sender As Object, e As System.EventArgs)
  
        Dim ID_item As GridDataItem = DirectCast(TryCast(sender, Button).NamingContainer, GridDataItem)
        Dim ID As String = ID_item.OwnerTableView.DataKeyValues(ID_item.ItemIndex)("ID")
        Session("ID") = ID
        Session("DataBase") = rcb_Database.SelectedValue
        Session("Site") = rcb_Site.SelectedValue
  
        Dim windowManager As New RadWindowManager()
        Dim RadWindow As New RadWindow()
        RadWindow.NavigateUrl = "user_mod_modal.aspx"
        RadWindow.ID = "RadWindow1"
        RadWindow.VisibleOnPageLoad = True
        RadWindow.Height = 375
        RadWindow.Width = 550
        RadWindow.Modal = True
        windowManager.Windows.Add(RadWindow)
        Me.form1.Controls.Add(RadWindow)
  
  
    End Sub
  
  
    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
        If e.Argument = "Rebind" Then
            rgd_ABIUser.MasterTableView.SortExpressions.Clear()
            rgd_ABIUser.MasterTableView.GroupByExpressions.Clear()
            rgd_ABIUser.DataSource = GetUser()
            rgd_ABIUser.Rebind()
        ElseIf e.Argument = "RebindAndNavigate" Then
            rgd_ABIUser.MasterTableView.SortExpressions.Clear()
            rgd_ABIUser.MasterTableView.GroupByExpressions.Clear()
            rgd_ABIUser.MasterTableView.CurrentPageIndex = rgd_ABIUser.MasterTableView.PageCount - 1
            rgd_ABIUser.DataSource = GetUser()
            rgd_ABIUser.Rebind()
        End If
    End Sub
  
End Class


Modal form ASPX

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="user_mod_modal.aspx.vb" Inherits="_Default" EnableEventValidation="false" %>
  
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title>Aeries Global System Manager</title>
<link rel="stylesheet" type="text/css" href="~/includes/ITC_Main.css" /> 
  
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">   
        <script type="text/javascript">
            function CloseAndRebind(args) {
                GetRadWindow().BrowserWindow.refreshGrid(args);
                GetRadWindow().close();
            }
  
            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 CancelEdit() {
                GetRadWindow().close();
            }
        </script>
  
  
    </telerik:RadCodeBlock>  
  
  
  
  
</head>
<body>
    <form id="form1" runat="server">
    <div id="header">
  
        <table cellpadding="0" cellspacing="0" style="width: 100%; height: 40px;">
            <tr>
                <td style="width: 213px">
                    <img alt="" src="../../images/aalogo.gif" /></td>
                <td style="text-align: right">
                    <img alt="" src="../../images/aatusdlogo.gif" /></td>
            </tr>
        </table>
  
    </div>
        <div id="subheader">
  
    </div>
            <div>
        <table cellpadding="0" cellspacing="0" style="width: 100%">
            <tr>
                <td valign="top" 
                    style="background-color: #FFFFFF; border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #000000;">
                    <table cellpadding="0" cellspacing="0" style="width: 100%">
                        <tr>
                            <td style="padding: 10px">
                                <table align="center" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td style="font-size: large; font-weight: bold; color: #7698BA; text-align: center">
                                            Modify ABI User Details</td>
                                    </tr>
                                    <tr>
                                        <td>
<asp:Label ID="Label1" runat="server" Text="Label" 
                        style="color: #FFFFFF"></asp:Label
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
<telerik:RadGrid ID="rgd_ABIUser" runat="server"  GridLines="None" AutoGenerateColumns="False" Width="400px">
    <MasterTableView DataKeyNames="ID">
        <RowIndicatorColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn DataField="SC" HeaderText="Site" SortExpression="SC" UniqueName="SC">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("SC") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="ID" HeaderText="User" SortExpression="ID" UniqueName="ID">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="PW" HeaderText="Password" SortExpression="PW" UniqueName="PW">
                    <ItemTemplate>
                        <asp:TextBox ID="tbx_Password"  Text='<%# Bind("PW") %>' runat="server"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="SN" HeaderText="TCH#" SortExpression="SN" UniqueName="SN" >
                    <ItemTemplate>
                        <asp:TextBox ID="tbx_TchNo"  Text='<%# Bind("SN") %>' runat="server" style="text-align:center;" Width="30px"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="TG" HeaderText="Group" SortExpression="TG" UniqueName="TG">
                    <ItemTemplate>
                        <asp:TextBox ID="tbx_TG"  Text='<%# Bind("TG") %>' runat="server" style="text-align:center;"  Width="20px"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
    </MasterTableView>
</telerik:RadGrid>
  
  
   
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">
                                            <asp:Button ID="btn_UpdateUser" OnClick="btn_UpdateUser_Click" runat="server" Text="Update" />
  
  
   
                                        </td>
                                    </tr>
                                </table>
  
  
                                <br />
                                <br />
                                <br />
                                <br />
  
  
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
            <div id="footer">
  
    </div>
  
  
    <telerik:RadScriptManager ID="rsm_AeriesAdmin" Runat="server">
    </telerik:RadScriptManager>
    <br />
      
    <br />
      
    </form>
      
    </body>
</html>

Modal form VB

Imports System.Data
Imports System.Data.SqlClient
Imports Telerik.Web.UI
Imports System.CodeDom
Imports System.Web
Imports System.Web.Security
Imports System.Web.Security.Roles
Imports System.Web.Security.Membership
Imports System.Security
Imports System.Security.Principal.WindowsIdentity
Partial Class _Default
    Inherits System.Web.UI.Page
  
  
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
  
        If Not Page.IsPostBack Then
  
            rgd_ABIUser.DataSource = GetUser()
            rgd_ABIUser.DataBind()
  
        End If
  
    End Sub
  
  
  
  
  
    Private Function GetUser() As DataTable
  
        Dim DatabaseName = Session("DataBase")
        Dim Site = Session("Site")
        Dim IDUser As String = Session("ID")
  
        Dim connectionString = New SqlConnection("server=DO-IT-AB\MSSQLAB;database=AeriesAdmin;UID=XXX;PWD=XXX;")
        Dim command = New SqlCommand("aa_abi_users_by_id", connectionString)
  
        command.CommandType = CommandType.StoredProcedure
  
        command.Parameters.Add("@DBName", SqlDbType.VarChar).Value = DatabaseName
        command.Parameters.Add("@ID", SqlDbType.VarChar).Value = IDUser
  
        command.Connection.Open()
  
        Dim myDataAdapter As New SqlDataAdapter(command)
        Dim myDataSet As New DataSet
        Dim dtData As New DataTable
        myDataAdapter.Fill(myDataSet)
        Return myDataSet.Tables(0)
  
        command.Connection.Close()
  
    End Function
  
     
    Protected Sub btn_UpdateUser_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  
        For Each item As GridDataItem In rgd_ABIUser.MasterTableView.Items
  
            Dim tbx_Password As TextBox = DirectCast(item("PW").FindControl("tbx_Password"), TextBox)
            Dim PW As String = tbx_Password.Text
  
            Dim tbx_TchNo As TextBox = DirectCast(item("SN").FindControl("tbx_TchNo"), TextBox)
            Dim SN As String = tbx_TchNo.Text
  
            Dim tbx_TG As TextBox = DirectCast(item("TG").FindControl("tbx_TG"), TextBox)
            Dim TG As String = tbx_TG.Text
  
            Dim DatabaseName As String = Session("DataBase")
            Dim Val = Session("Site")
            Dim Site As Integer = Convert.ToInt32(Val)
  
            Dim IDUser As String = Session("ID")
  
            Dim connectionString = New SqlConnection("server=DO-IT-AB\MSSQLAB;database=AeriesAdmin;UID=XXX;PWD=XXX;")
            Dim command = New SqlCommand("aa_abi_users_update", connectionString)
  
            command.CommandType = CommandType.StoredProcedure
  
            command.Parameters.Add("@DBName", SqlDbType.VarChar).Value = DatabaseName
            command.Parameters.Add("@IDSite", SqlDbType.Int).Value = Site
            command.Parameters.Add("@IDUser", SqlDbType.VarChar).Value = IDUser
            command.Parameters.Add("@PW", SqlDbType.VarChar).Value = PW
            command.Parameters.Add("@SN", SqlDbType.VarChar).Value = SN
            command.Parameters.Add("@TG", SqlDbType.VarChar).Value = TG
  
            command.Connection.Open()
            command.ExecuteNonQuery()
            command.Connection.Close()
  
        Next
  
        If Session("DataBase") IsNot Nothing Then
            Session.Remove("DataBase")
        End If
        If Session("Site") IsNot Nothing Then
            Session.Remove("Site")
        End If
        If Session("IDUser") IsNot Nothing Then
            Session.Remove("IDUser")
        End If
  
        Label1.Text = "<script type='text/javascript'>CloseAndRebind()</" + "script>"
  
    End Sub
  
  
  
  
End Class






Allan
Top achievements
Rank 2
 asked on 18 Mar 2011
4 answers
233 views
I would like to get the value of a textbox in a GridTemplateColumn. I have tried and tried to find an answer to this question. Please DO NOT refer me to any of the following:

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx

http://www.telerik.com/community/forums/aspnet-ajax/grid/retrieving-value-from-radgrid-in-editmode-on-a-external-button-click.aspx

http://www.telerik.com/community/forums/aspnet-ajax/grid/button-click-event-and-radgrid.aspx

I have been to dozens and dozens of these links and NONE of them provide a simple, straight forward example to solve this. I have left several posts requesting similar examples with no resolution. Here is the code I am attempting to use:

ASPX:

<telerik:RadGrid ID="rgd_ABIUser" runat="server"  GridLines="None" AutoGenerateColumns="False" Width="400px" style="height: 46px">
    <MasterTableView DataKeyNames="ID">
        <RowIndicatorColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn DataField="SC" HeaderText="Site" SortExpression="SC" UniqueName="SC">
                    <ItemTemplate>
                        <asp:TextBox ID="tbx_Site"  Text='<%# Bind("SC") %>' runat="server" Width="30px"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="ID" HeaderText="User" SortExpression="ID" UniqueName="ID">
                    <ItemTemplate>
                        <asp:TextBox ID="tbx_UserID"  Text='<%# Bind("ID") %>' runat="server"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="PW" HeaderText="Password" SortExpression="PW" UniqueName="PW">
                    <ItemTemplate>
                        <asp:TextBox ID="tbx_Password"  Text='<%# Bind("PW") %>' runat="server"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="SN" HeaderText="TCH#" SortExpression="SN" UniqueName="SN" >
                    <ItemTemplate>
                        <asp:TextBox ID="tbx_TchNo"  Text='<%# Bind("SN") %>' runat="server" Width="30px"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="TG" HeaderText="Group" SortExpression="TG" UniqueName="TG">
                    <ItemTemplate>
                        <asp:TextBox ID="tbx_TG"  Text='<%# Bind("TG") %>' runat="server" Width="20px"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
    </MasterTableView>
</telerik:RadGrid>

Here is my ASPX.VB

Protected Sub btn_UpdateUser_Click(sender As Object, e As System.EventArgs) Handles btn_UpdateUser.Click
    For Each item As GridDataItem In rgd_ABIUser.Items
        'Here is one way I have seen to get the value
        Dim txtBox As TextBox = DirectCast(item("PW").FindControl("tbx_Password"), TextBox)
        Dim PW As String = txtBox.Text
        'Here is a different way I have seen to get the value
        Dim SN As String = DirectCast(TryCast(item.FindControl("tbx_TchNo"), TextBox).Text, String)
        Dim TG As String = DirectCast(TryCast(item.FindControl("tbx_TG"), TextBox).Text, String)
        Dim DatabaseName As String = Session("DataBase")
        Dim Val = Session("Site")
        Dim Site As Integer = Convert.ToInt32(Val)
        Dim IDUser As String = Session("ID")
        Dim connectionString = New SqlConnection("server=DO-IT-AB\MSSQLAB;database=XXXX;UID=XXXX;PWD=XXX;")
        Dim command = New SqlCommand("aa_abi_users_update", connectionString)
        command.CommandType = CommandType.StoredProcedure
        command.Parameters.Add("@DBName", SqlDbType.VarChar).Value = DatabaseName
        command.Parameters.Add("@IDSite", SqlDbType.Int).Value = Site
        command.Parameters.Add("@IDUser", SqlDbType.VarChar).Value = IDUser
        command.Parameters.Add("@PW", SqlDbType.VarChar).Value = PW
        command.Parameters.Add("@SN", SqlDbType.VarChar).Value = SN
        command.Parameters.Add("@TG", SqlDbType.VarChar).Value = TG
        command.Connection.Open()
        command.ExecuteNonQuery()
        command.Connection.Close()
    Next

Any help much appreciated.

Allan
Top achievements
Rank 2
 answered on 18 Mar 2011
2 answers
73 views
I am looking for an efficient way to take the filtered value from one RadGrid and pass that value to another RadGrid (to update the data).

A quick search yielded no results, is this something any of you have tried before? If so, can you point me in the right direction?

Thanks!
Royal
Top achievements
Rank 1
 answered on 18 Mar 2011
1 answer
82 views
Hello,

I have a menu that when a user clicks an item it postback using the RadAjaxPanel.

Well in certain items i need to cancel the ajax request for like the 'DOWNLOAD FILE' item but leave it on for other items.

Im using the Panels onRequestStart but all it returns in the eventtarget is my menu ID is there anyway to find the ITEM within the menu that triggered the AJAX?

Or should i make a custom menu items with buttons?

CODE:
<script type="text/javascript">
            function onRequestStart(sender, args) {
                if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToPdfButton") >= 0) {
                    args.set_enableAjax(false);
                }
                if (args.get_eventTarget().indexOf("FilesMenu") >= 0)
                {
                    alert("ET: " + args.get_eventTarget());
                    alert("EA: " + args.get_eventArgument());
                    alert("ETE ID: " +args.get_eventTargetElement().id);
                    args.set_enableAjax(false);
                }
            }
        </script>
Helen
Telerik team
 answered on 18 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?