Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
115 views
In my application, it will pop up a radwindow when user add/edit record.
And I want to databind a combox from a string, but my code not working.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Allowance.aspx.vb" Inherits="Payroll_Allowance" %>
<%@ 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">
 
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" Height="100%" Orientation="Horizontal">
 
        <telerik:RadPane ID="rpContent" runat="server">
 <asp:Panel ID="Panel1" runat="server" Width="100%"  CssClass=thePanel>
        <asp:Table ID="Table0" runat="server" Height="100%">
            <asp:TableRow>
                <asp:TableCell Font-Bold="true" font-size="10pt" CssClass=theHead>
        Payroll Allowance  
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </asp:Panel>
    <telerik:RadToolBar ID="rtbMain" runat="server" Width="100%">
    <Items>
    <telerik:RadToolBarButton Width="80px" Value="Add" Text="Add" CausesValidation="false"></telerik:RadToolBarButton>
    <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton>
  <%--  <telerik:RadToolBarButton Width="80px" Value="Edit" Text="Edit" CausesValidation="false" Enabled=false></telerik:RadToolBarButton>
    <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton>
    <telerik:RadToolBarButton Width="80px" Value="Delete" Text="Delete" CausesValidation="false" Enabled=false></telerik:RadToolBarButton>
    <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton>
  --%> 
    <telerik:RadToolBarButton Width="80px" Value="Report" Text="Report" visible=false CausesValidation="false"></telerik:RadToolBarButton>
    <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton>
     
    </Items>
    </telerik:RadToolBar>
    <div id="printarea">
    <asp:Table ID="tblHistory" width=800px runat="server" >
    <asp:TableRow>
    <asp:TableCell>
    <asp:Table ID="Table1" runat="server" Width=650 BorderStyle=None>
    <asp:TableRow>
    <asp:TableCell CssClass=fieldheader Width=150>Staff Name</asp:TableCell>
    <asp:TableCell Width=250><asp:Label ID="lbStaffName" runat=server></asp:Label></asp:TableCell>
    <asp:TableCell CssClass=fieldheader Width=150>Staff No.</asp:TableCell>
    <asp:TableCell Width=250><asp:Label ID="lbStaffNo" runat=server></asp:Label></asp:TableCell>
 
    </asp:TableRow>
    </asp:Table>
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    <br />
    <telerik:RadGrid ID="rgAllowance" runat="server" DataSourceID="ldsAllowance"
                    GridLines="None" Width="800px" AllowSorting="True" AutoGenerateColumns="false" AllowFilteringByColumn="false" ShowGroupPanel=false ShowFooter="False"
                    AllowPaging="True" PageSize="15">
                    <PagerStyle Position="TopAndBottom" />
                     
        <ClientSettings EnablePostBackOnRowClick="True" AllowColumnsReorder="True" AllowDragToGroup="false" ReorderColumnsOnClient="True">
            <Selecting AllowRowSelect="True" />            
        </ClientSettings>
           
         
                    <MasterTableView DataSourceID="ldsAllowance" DataKeyNames="AllowanceID" >
                        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                        <RowIndicatorColumn>
                            <HeaderStyle Width="10px"></HeaderStyle>
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="10px"></HeaderStyle>
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn DataField="AllowanceID" HeaderText="Allowance ID" ReadOnly="True"
                                SortExpression="AllowanceID" UniqueName="AllowanceID" Visible=false>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="PPSCompanyCode" HeaderText="Allowance Code" ReadOnly="True"
                                SortExpression="PPSCompanyCode" UniqueName="PPSCompanyCode"><ItemStyle Font-Underline="True" BackColor=White ForeColor="Blue" BorderColor=ActiveBorder/>
                            </telerik:GridBoundColumn>                           
                            <telerik:GridBoundColumn DataField="EntitleFrom" HeaderText="Entitle From" ReadOnly="True"  DataFormatString="{0:dd-MMM-yyyy}"
                                SortExpression="EntitleFrom" UniqueName="EntitleFrom"><ItemStyle BackColor=White  BorderColor=ActiveBorder />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="EntitleTo" HeaderText="Entitle To" ReadOnly="True"  DataFormatString="{0:dd-MMM-yyyy}"
                                SortExpression="EntitleTo" UniqueName="EntitleTo"><ItemStyle BackColor=White BorderColor=ActiveBorder/>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="AllowanceAmount" HeaderText="Remarks" ReadOnly="True" DataFormatString="{0:N}"
                                SortExpression="AllowanceAmount" UniqueName="AllowanceAmount"><ItemStyle BackColor=White BorderColor=ActiveBorder/>
                            </telerik:GridBoundColumn>
                            
 
 
                            </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
    </div>
        </telerik:RadPane>
    </telerik:RadSplitter>
    <telerik:RadWindow ID="RadWindow1" runat="server" Width="580px" Height="300px" Behaviors="Close"
        Title="Add/Modify Payroll Allowance" >
        <ContentTemplate>
            <asp:Table ID="Table2" runat="server" Width="100%" Height="100%">
                
                <asp:TableRow >
                <asp:TableCell CssClass="editheader">Allowance Code: </asp:TableCell>
                <asp:TableCell>
                    <telerik:RadComboBox ID="dfAllowanceCode" runat="server" Width="250px"
                    AppendDataBoundItems="true" AutoPostBack="true"
                    OnDataBound="dfAllowanceCode_DataBound">
                     <Items>
                        <telerik:RadComboBoxItem Text="--Select--" Value="" />
                    </Items>
                    </telerik:RadComboBox>
 
                </asp:TableCell>
                  </asp:TableRow>
 
                <asp:TableRow>  
                    <asp:TableCell CssClass="editheader">Entitle From: </asp:TableCell>
                    <asp:TableCell>
                        <asp:HiddenField ID="dfAllowanceID" Value="0" runat="server" />
                        <telerik:RadDatePicker ID="dfStartDate" runat="server" Width="150px" DateInput-DateFormat="dd-MMM-yyyy" Enabled=false>
                        </telerik:RadDatePicker>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="* Required"
                            ControlToValidate="dfStartDate"></asp:RequiredFieldValidator>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell CssClass="editheader">Entitle To: </asp:TableCell>
                    <asp:TableCell>
                       <telerik:RadDatePicker ID="dfEndDate" runat="server" Width="150px" DateInput-DateFormat="dd-MMM-yyyy" Enabled=false>
                        </telerik:RadDatePicker>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="* Required"
                            ControlToValidate="dfEndDate"></asp:RequiredFieldValidator>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell CssClass="editheader">Amount: </asp:TableCell>
                    <asp:TableCell>
                        <telerik:RadNumericTextBox  ID="dfAmount" runat="server" Width="400px" Height="50px" Enabled="false"
                        NumberFormat-DecimalDigits="2" >
                        </telerik:RadNumericTextBox >
                    </asp:TableCell>
                </asp:TableRow>
 
                <asp:TableRow>
                    <asp:TableCell BackColor="#EEEEEE" ColumnSpan="2" HorizontalAlign="Center">
                        <asp:Button ID="btnSave" runat="server" Text="Save" Width="80px" />  
                        <asp:Button ID="btnDelete" runat="server" Text="Delete" Width="80px" CausesValidation="false" />
                        <asp:Button ID="btnCancel" runat="server" Text="Close" Width="80px" CausesValidation="false" />
                    </asp:TableCell>
                </asp:TableRow>
            </asp:Table>
        </ContentTemplate>
    </telerik:RadWindow>
 
    <asp:LinqDataSource ID="ldsAllowance" runat="server" ContextTypeName="dcHRISDataContext"
        OrderBy="EntitleFrom desc,AllowanceID desc"
        TableName="HRIS_PPSAllowances" Where="SID==@SID">
         <WhereParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="SID" QueryStringField="SID"
                Type="Int32" />               
        </WhereParameters>
    </asp:LinqDataSource>
 
    </form>
</body>
</html>

Code Behind:

Protected Sub dfAllowanceCode_DataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles dfAllowanceCode.DataBound
    dfAllowanceCode.Items.Clear()
  
    Dim S As String = "PPS123, PPS22323, PPS5454, PPS1231"
    Dim arrayvalue As String() = S.Split(","c)
 
    For i As Integer = 0 To arrayvalue.Length - 1
        dfAllowanceCode.Items.Add(New Telerik.Web.UI.RadComboBoxItem(arrayvalue(i).ToString(), i))
    Next
 
End Sub








Nencho
Telerik team
 answered on 09 Sep 2013
1 answer
86 views
Hello,
I currently have a hierarchical grid where I need to selectively hide certain columns and prevent it from appearing in Add/Edit form. I am able to selectively hide the column but was not able to prevent it from appearing in the Edit Form when user click on Add or Edit

Here is the snippet of one of columns that I need to hide programatically. Note that I am not using GrodBoundColumn and most of my columns are using GridTemplateColumn with ItemTemplate and EditItemTemplate as shown below
<telerik:GridTemplateColumn UniqueName="WellnessFactor" HeaderText="Wellness Factor<span style='color:#CD4800'>*</span>">
      <ItemTemplate>
          <%#DataBinder.Eval(Container.DataItem, "WellnessFactor")%>
      </ItemTemplate>
      <EditItemTemplate>
          <telerik:RadComboBox ID="WellnessFactorComboBox" runat="server" AllowCustomText="false"
              AutoPostBack="false" CausesValidation="false" DataTextField="WellnessFactor"
              DataValueField="WellnessFactor" EmptyMessage="Please Select..." EnableVirtualScrolling="true"
              Height="45px" MarkFirstMatch="true" NoWrap="True" Skin="WebBlue" Width="150px">
              <Items>
                  <telerik:RadComboBoxItem Text="Yes" Value="Yes" />
                  <telerik:RadComboBoxItem Text="No" Value="No" />
              </Items>
          </telerik:RadComboBox>
          <asp:RequiredFieldValidator ID="ValidateWellnessFactorComboBox" runat="server" ControlToValidate="WellnessFactorComboBox"
              ValidationGroup="SubscriberGroup" ErrorMessage="*This field is required" ForeColor="Red"
              InitialValue="">
          </asp:RequiredFieldValidator>
      </EditItemTemplate>
  </telerik:GridTemplateColumn>

Here is the snippet of code use to hide the column

protected void RadGrid1_OnPreRender(object sender, EventArgs e)
{
    if (listHideColumn.Count > 0)
    {
        foreach (GridColumn column in RadGrid1.Columns)
        {
            foreach (string columnName in listHideColumn)
            {
                if (column.UniqueName == columnName)
                {
                    column.Visible = false;
                    //(column as GridBoundColumn).Visible = false;
                    break;
                }
            }
        }
    }
}

Most of the solution I found online is to make the column readonly. But I am not using GridBoundColumn. Is there a way to prevent it from appearing it in Edit Form when user click on Add or Edit since they are not visible on the Grid. Note that I am using auto generating form.

Your help in resolving this will be greatly appreciated.

Thank you.

-Yoong
Shinu
Top achievements
Rank 2
 answered on 09 Sep 2013
5 answers
177 views
Hi Telerik.

I was looking in forums for excel 2010 support in Telerik Rad Grid.
As currently when we export to excel it prompts following message:

The file you are trying to open, '[filename].xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

Which users find annoying. When I was going through  forums I had read that you are going to add support for excel 2010 in Q3-Q4 2012.
However didn't find any concrete answers yet on this release.

Could you please let us know whether the support for excel 2010 has been released for Telerik Rad Grid which will also suppress above message?

Thanks,
Aditi
Kostadin
Telerik team
 answered on 09 Sep 2013
1 answer
228 views
Hello Telerik Team,

I am having a problem when rebind the grid on second time with same data source . Everything is same . When first time i call the Rebind function it works fine but on second time it throws Syntax error: Missing operand before 'is' operator. Please help me.

Here is my code
Aspx file
 <telerik:RadGrid ID="rdGridDetailTable" runat="server" AllowSorting="true" Height="400px"
                                                                                    GridLines="both" AutoGenerateColumns="false" OnDetailTableDataBind="rdGridDetailTable_DetailTableDataBind"
                                                                                    OnNeedDataSource="rdGridDetailTable_NeedDataSource" AutoGenerateHierarchy="true"
                                                                                    MasterTableView-ExpandCollapseColumn-HeaderStyle-Width="30px">
                                                                                    <MasterTableView>
                                                                                    </MasterTableView>
                                                                                    <ClientSettings>
                                                                                        <Scrolling AllowScroll="True" SaveScrollPosition="True"></Scrolling>
                                                                                    </ClientSettings>
                                                                                    <HeaderStyle CssClass="HeaderRow" />
                                                                                    <CommandItemStyle BorderColor="#003399" BorderStyle="Solid" BorderWidth="1px" />
                                                                                    <FilterMenu EnableImageSprites="False">
                                                                                    </FilterMenu>
                                                                                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                                                                                    </HeaderContextMenu>
                                                                                </telerik:RadGrid>

aspx.cs


   #region Show Graphs
        private void ShowTable(string value)
        {
                    chartHolder.Controls.Clear();
                    DataSet ds = CalculateAttractivity();
                    PopulateTable(ds.Tables[0], ds.Tables[1]);
                    break;
            
        }
        #endregion


        #region populate table
        private void PopulateTable(DataTable dtData, DataTable dtDataDetails)
        {
            if (GridStructure == false)
            {
                DefineGridStructure(dtData, dtDataDetails);
            }
            trUserDataArea1.Style.Add(" background-color", GraphMin.BackColor.ToString());
            tblDetails.Style.Add("display", "block");
            tblDetails.Visible = true;
            chartHolder.Visible = false; //showing chart 
            Attractivity = dtData;
            AttractivityDetails = dtDataDetails;
            rdGridDetailTable.Rebind();
        }
        #endregion

 #region RadGrid Structure
        private void DefineGridStructure(DataTable dtData, DataTable dtDetail)
        {
            SystemLocalizationBO systemLocalizationBO = new SystemLocalizationBO(true);
            SystemSession sys = hdr.SysSession;
            var weight = SessiontblComponentModel1.Rows.Cast<DataRow>().Select(row => row[10].ToString()).ToArray();
            rdGridDetailTable.Columns.Clear();
            rdGridDetailTable.MasterTableView.Columns.Clear();
            rdGridDetailTable.MasterTableView.DataKeyNames = new string[] { dtData.Columns[0].ColumnName };
            rdGridDetailTable.Width = Unit.Percentage(98);
            rdGridDetailTable.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
            rdGridDetailTable.MasterTableView.DataMember = "Table";
            rdGridDetailTable.AutoGenerateColumns = false;
            string strTable = "<table><tr><td>";
            //Add columns
            int Count = 0;
            foreach (DataColumn dc in dtData.Columns)
            {
                strTable = "<table><tr><td>";
                GridBoundColumn boundColumn;
                boundColumn = new GridBoundColumn();
                boundColumn.DataField = "[" + dc.ColumnName + "]";

                if (Count > 2)
                {
                    strTable = strTable + dc.ColumnName + "</td></tr><tr><td>";
                    strTable = strTable + weight[Count - 3] + "</td></tr></table>";
                    boundColumn.HeaderStyle.Width = 10;
                    boundColumn.HeaderText = strTable;
                    boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    boundColumn.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
                }
                else
                {
                    
                    boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    boundColumn.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
                    if (Count == 1)
                    {
                        strTable = strTable + dc.ColumnName + "</td></tr><tr><td>";
                        strTable = strTable + systemLocalizationBO.GetErrorMessage(31075, sys.CurrentUserLanguage.ToString()) + "</td></tr></table>";
                        boundColumn.HeaderText = strTable; 
                    }
                    else
                    {
                        strTable = strTable + dc.ColumnName + "</td></tr><tr><td>";
                        strTable = strTable  + "&nbsp;</td></tr></table>";
                        boundColumn.HeaderText = strTable;
                    }
                }
                rdGridDetailTable.MasterTableView.Columns.Add(boundColumn);
                Count++;
            }
            //Detail table - Orders (II in hierarchy level)
            GridTableView tableViewOrders = new GridTableView(rdGridDetailTable);
            tableViewOrders.Columns.Clear();
            tableViewOrders.Width = Unit.Percentage(100);
            tableViewOrders.DataKeyNames = new string[] { dtData.Columns[0].ColumnName };
            tableViewOrders.DataMember = "Table";
            GridRelationFields relationFields = new GridRelationFields();
            tableViewOrders.ParentTableRelation.Add(relationFields);
            relationFields.MasterKeyField = dtData.Columns[0].ColumnName;
            relationFields.DetailKeyField = dtData.Columns[0].ColumnName;
           
            rdGridDetailTable.MasterTableView.DetailTables.Add(tableViewOrders);
            //Add columns
            Count = 0;
            foreach (DataColumn dc in dtDetail.Columns)
            {
                GridBoundColumn boundColumn;
                boundColumn = new GridBoundColumn();
                boundColumn.DataField = "[" + dc.ColumnName + "]";
                boundColumn.HeaderText = dc.ColumnName;
                if (Count == 0)
                {
                    boundColumn.Visible = false;
                }
                tableViewOrders.Columns.Add(boundColumn);
                Count = 1;
            }
            GridStructure = true;
        }
        #endregion

   protected void rdGridDetailTable_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            if (Attractivity != null)
            {
                rdGridDetailTable.DataSource = Attractivity;
                rdGridDetailTable.MasterTableView.DetailTables[0].DataSource = AttractivityDetails;
            }
        }


protected void rdGridDetailTable_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            try
            {
                GridDataItem parentItem = e.DetailTableView.ParentItem as GridDataItem;
                if (parentItem.Edit)
                {
                    return;
                }
                if (parentItem.GetDataKeyValue(AttractivityDetails.Columns[0].ColumnName).ToString() != string.Empty)
                {
                    e.DetailTableView.DataSource = AttractivityDetails.Select(AttractivityDetails.Columns[0].ColumnName + " = '" + parentItem.GetDataKeyValue(AttractivityDetails.Columns[0].ColumnName).ToString() + "'").CopyToDataTable();
                }
                
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

Thanks in advance

Nishant Mittal
Kostadin
Telerik team
 answered on 09 Sep 2013
7 answers
255 views
I have a radgrid that has been performing perfectly until i upgraded to 2013.1.417.40 yesterday. 

My grid is inside a radpanelitem.  The edit form is set to be a modal popup and worked as expected prior to the recent upgrade.  Now, the popup is restricted to the radpanelitem and barely visible depending on the size of the radpanelitem.

If the edit form popup is visible, i can grab it and move it, but only within the confines of the radpanelitem container.  It should pop over the entire window (as it used to.)  I have other grids that are not contained in the radpanelitem and those pop properly.  

Anyone encounter this or have a solution?  I have tried messing with z-index settings but that isn't getting me anywhere. 
Sasa
Top achievements
Rank 1
 answered on 09 Sep 2013
1 answer
101 views
Hi All,

I am using radgrid which was working fine for a long time.

But recently the css got changed in the server.

I checked it in the local machine it works fine. I even checked the code, both are exactly the same.

This happened before two weeks, But I am not sure about it.

Is there any way to solve this.

Have attached both the screen shots in local and in server.

-Anto

Venelin
Telerik team
 answered on 09 Sep 2013
1 answer
93 views
hi, I just used radautocomplete box, it works fine but returns record as "System.data.datarowview". Can you please let me know why this is happening? thank you
Shinu
Top achievements
Rank 2
 answered on 09 Sep 2013
2 answers
167 views
I'm using the Rad Grid to sort via drag and drop, which is working pretty great. I'm also using a textbox and imagebutton as a second method of sorting my data. To do this I am passing the RowIndex to the ItemCommand then using that rowindex to find my textbox with the new sortID value in it. For some reason it looks like inside the ItemDataBound of the RadGrid The RowIndex gets doubled and it would also seem it uses a 1 based index instead of a 0 based. When i try to find the control using that index it wants to use a zero based index and the doubled index also causes error. I've fixed the problem by dividing the rowindex by 2 and then subtracting 1 for the 0 based index. This solution actually seems to be working fine. However, I don't like using a hack that I don't fully understand. The follow code works, but I'd like to know why i have to divide by 2 and subtract 1 in order for it to work correctly. Look at this line  iRowIndex = (iRowIndex / 2) - 1


Protected Sub rgList_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgList.ItemCommand
 
        If TypeOf e.CommandSource Is ImageButton AndAlso CType(e.CommandSource, ImageButton).ID = "btnSort" Then
 
            Dim iEntityID As Integer = 0
            iEntityID = e.CommandArgument.ToString.Split("|")(0)
 
            Dim iRowIndex As Integer
            iRowIndex = e.CommandArgument.ToString.Split("|")(1)
 
            iRowIndex = (iRowIndex / 2) - 1
 
            Dim iNewSortID As Integer = 0
            Dim txtSortID As TextBox
            txtSortID = rgList.Items(iRowIndex).FindControl("txtSortID")
 
            If IsNumeric(txtSortID.Text) AndAlso txtSortID.Text > 0 Then
                iNewSortID = txtSortID.Text
 
                If iEntityID > 0 Then
                    Dim oItem As New CollectTech.Items.Item(iEntityID)
 
                    If oItem.SortID <> iNewSortID Then
                        oItem.SortID = iNewSortID
                        oItem.UpdateSortID()
                        oItem.Dispose()
                    End If
                End If
            End If
 
            LoadData()
        End If
 
    End Sub
 
    Protected Sub rgList_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles rgList.ItemDataBound
 
        If e.Item.ItemType = Telerik.Web.UI.GridItemType.Item OrElse e.Item.ItemType = Telerik.Web.UI.GridItemType.AlternatingItem Then
 
            Dim oItem As CollectTech.Items.Item = e.Item.DataItem
            Dim litItemName As Literal = e.Item.FindControl("litItemName")
            Dim txtSortID As TextBox = e.Item.FindControl("txtSortID")
            Dim btnSort As ImageButton = e.Item.FindControl("btnSort")
 
            litItemName.Text = Server.HtmlEncode(oItem.Name)
 
            txtSortID.Text = oItem.SortID
 
            btnSort.CommandArgument = oItem.ID & "|" & e.Item.RowIndex
 
            imgThumbnail.ImageUrl = sImagePath
        End If
 
    End Sub
 
Dave
Top achievements
Rank 1
 answered on 09 Sep 2013
1 answer
46 views
Hi.I call javascript function in server side in Grid ItemCommand event :

protected void grd_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName != "Update") return;
            ClientScript.RegisterStartupScript(GetType(), "test", " $('#element_to_pop_up').bPopup({ speed: 650, transition: 'slideIn' });", true);
            var item = e.Item as GridDataItem;
            var id = item["colID"].Text;
            txtName.Text = item["col"].Text;
            lblMsg.Visible = false;
            Session["MeasureId"] = id;
        }

When I put my gird into my Button UpdatedControls , my javascript function doesn't work  and my popUp menu doesn't show ....

 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="txtName" />
                    <telerik:AjaxUpdatedControl ControlID="lblMsg" />
                    <telerik:AjaxUpdatedControl ControlID="grd" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

my PopUp is :

<div id="element_to_pop_up" style="border: thin solid #400000; padding-top: 30px; display: none; font-family: tahoma; font-size: small; width: 400px; float: right; direction: rtl; background-color: white">

        <div style="float: right; padding-right: 10px">
           Unit Name : &nbsp;
        </div>
        <div style="float: right">
            <telerik:RadTextBox ID="txtName" runat="server" Font-Names="tahoma">
            </telerik:RadTextBox>
        </div>
        <div style="width: 100%; float: left;">
            <div style="padding-top: 20px; padding-right: 10px">
                <asp:Label ID="lblMsg" runat="server" Text="Label" ForeColor="Maroon" Visible="False"></asp:Label>
            </div>
            <div style="padding: 20px; float: left">
                <telerik:RadButton ID="btnSave" runat="server" Text="Save" Font-Names="Tahoma" Skin="Office2010Black" Width="100px" Height="30px" ButtonType="LinkButton" OnClick="btnSave_Click"></telerik:RadButton>
            </div>
        </div>
    </div>
Shinu
Top achievements
Rank 2
 answered on 09 Sep 2013
3 answers
216 views
Hi,

I have a RadAutoCompleteBox and a CSS style to color the box differently depending on if the box is disabled or not.
Everything works fine except for when I have the AllowCustomEntry set to true.
When set to false (And the control disabled), the background and fore color both change to the color I want.
When set to true (And the control disabled), the background color changes, however, the fore color remains the same.

Code:
<telerik:RadAutoCompleteBox ID="ACP_Name" runat="server" DropDownHeight="150px"
Skin="Default" DropDownWidth="200px" Style="z-index: 1; left: 220px; top: 167px;
position: absolute; height: 22px; width: 210px" OnClientRequesting="OnClientRequesting"
InputType="Text" AllowCustomEntry="True" TextSettings-SelectionMode="Single">
<WebServiceSettings Method="GetName" Path="MyWebService.asmx" />
</telerik:RadAutoCompleteBox>



CSS:
div.RadAutoCompleteBox_Default .racDisabled
        {
            background-color: #000099;
            border-color: #FFFFFF;
            color: #CCCCCC;
        }


Is there anything I can do to get the text color to change when the AllowCustomEntry is set to true?


Thanks!


Princy
Top achievements
Rank 2
 answered on 09 Sep 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?