Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
224 views
Hello.
I am creating a servercontrol that inherits the radgrid.
I am creating it on "OnLoad"
I want to create a GridDropDownColumn that will be filled by a DataSet.
From what i read i saw i have 3 options :
1) GridDropDownColumn with DataSourceID  ,
 2) DropDownColumn that can "bind" to the gridDataSource ( the gridatasource must have both id and text - and i can only have the id) 
3) Template.
I can't use number 1 and 2. so the only option is template.
I created a class for ItemTemplate, and one for EditItemTemplate.
The problem i have is with the EditItemTemplate

   class DropDownListTemplate : IBindableTemplate<br>
    {<br>
        string dataField = null;<br>
        bool enabled;<br>
        DropDownList ddl = null;<br>
<br>
        public DropDownListTemplate(string dataField, bool enabled)<br>
        {<br>
            this.dataField = dataField;<br>
            this.enabled = enabled;<br>
        }<br>
<br>
        void ITemplate.InstantiateIn(Control container)<br>
        {<br>
            ddl = new DropDownList();<br>
            ddl.Enabled = enabled;<br>
            ddl.DataBinding += ddl_DataBinding;<br>
            container.Controls.Add(ddl);<br>
        }<br>
<br>
        void ddl_DataBinding(object sender, EventArgs e)<br>
        {<br>
            ddl = (DropDownList)sender;<br>
            ddl.ID = dataField;<br>
            GridEditFormItem bidingContainer = ddl.NamingContainer as GridEditFormItem;<br>
            string value =  ((DataRowView)bidingContainer.DataItem)[dataField].ToString();<br>
<br>
            ddl.Items.Add(value);<br>
<br>
        }<br>
  <br>
<br>
        IOrderedDictionary IBindableTemplate.ExtractValues(Control container)<br>
        {<br>
            OrderedDictionary dick = new OrderedDictionary();<br>
            dick.Add(dataField, ddl.SelectedValue.ToString());<br>
            return dick;<br>
        }<br>
    }




I wanted to make it only ITemplate but i got an error saying i need to make it IBindableTemplate.

On ItemDataBound i find the template, get the dropdownlist and bind it to my DataSet.
When i push the "Edit" command it works. The problem appears when i push "Update".

On the "GridTelerik_UpdateCommand" event i need to Extract the new values.
But i get an error at : ((GridEditableItem)e.Item).ExtractValues(newValues);

The error is : "Editor cannot be initialized for column :  <columnName> - where columnName is the uniqueName of the TemplateColumn.

Is there a way i can resolve it. Does it have a problem because i instantiate the column editItemTemplate on Load? In case there is a better solution for this situation please advice me.
Thanks.
Radoslav
Telerik team
 answered on 11 May 2011
1 answer
133 views
The server I'm developing on is running IIS 7.5, and my company uses Internet Explorer 8.  In my program, I have a series of steps that a user has to go through in sequence.  As one step is completed (via a button click), another step loads.  The steps are each in Panels, and I use a RadAjaxManager to update the next panel on button clicks so that the next panel is made visible.  The odd problem that I'm having right now is that whenever the next panel loads, the first RadNumericTextBox within the newly loaded panel will not hold the value typed into it.  For example, if, once the text box loads, the user types "100" and goes to the next text box, "100" will stay in the box, but if I were to try to find its value server-side, it would be blank.  If i were to click on the text box again, the value "100" will disappear.  Upon typing in the value again, it will change to "100.00" like it's supposed to whenever it loses focus, and the value will be available server-side.  This happens randomly, but if it does happen, it will only happen on the first time and on the first box.  Any help is much appreciated.

Here is my Markup:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="lookupButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="orderPanel" LoadingPanelID="RadAjaxLoadingPanel1" />      
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                                                                   
                        <telerik:AjaxUpdatedControl ControlID="countPanel" LoadingPanelID="RadAjaxLoadingPanel1" />  
                        <telerik:AjaxUpdatedControl ControlID="orderCount" LoadingPanelID="RadAjaxLoadingPanel1" />  
                        <telerik:AjaxUpdatedControl ControlID="amountPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>           
                <telerik:AjaxSetting AjaxControlID="inputButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="amountPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="amountList" LoadingPanelID="RadAjaxLoadingPanel1" />       
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                                                                   
                    </UpdatedControls>
                </telerik:AjaxSetting>           
                <telerik:AjaxSetting AjaxControlID="printButton">
                    <UpdatedControls>                       
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                       
                        <telerik:AjaxUpdatedControl ControlID="printButton" LoadingPanelID="RadAjaxLoadingPanel1" />                                           
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>       
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="WebBlue" />
    <asp:Panel ID="orderPanel" runat="server" DefaultButton="lookupButton">
        <fieldset>
            <legend>Order Information</legend>
            <table>
                <tr>
                    <td align="left"><telerik:RadNumericTextBox ID="orderNum" Width="150px" runat="server" MaxLength="6" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" DataType="Int32"></telerik:RadNumericTextBox></td>
                    <td align="left"><asp:Button ID="lookupButton" runat="server" Text="Look Up Order" OnClick="LookupButton_Click" /></td>
                </tr>
                <tr>
                    <td align="left"><asp:Label ID="orderSalesText" runat="server" Font-Size="Small" Font-Bold="true" Text="Money Order Amount: "></asp:Label></td>
                    <td align="left"><asp:Label ID="orderSalesValue" runat="server" Font-Size="Small" Font-Bold="true"></asp:Label></td>
                </tr>
                <tr>
                    <td align="left"><asp:Label ID="orderFeesText" runat="server" Font-Size="Small" Font-Bold="true" Text="Money Order Fees: "></asp:Label></td>
                    <td align="left"><asp:Label ID="orderFeesValue" runat="server" Font-Size="Small" Font-Bold="true"></asp:Label></td>
                </tr>
            </table>
        </fieldset>
    </asp:Panel>
    <br />
    <br />
    <asp:Panel ID="logPanel" runat="server">
         
    </asp:Panel>
    <asp:Panel ID="countPanel" runat="server" DefaultButton="inputButton" Visible="false">
        <fieldset>
            <legend>Total Money Orders</legend>
            <table>
                <tr>
                    <td align="left"><telerik:RadNumericTextBox ID="orderCount" Width="150px" runat="server" MaxLength="2" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" DataType="Int32"></telerik:RadNumericTextBox></td>
                    <td align="left"><asp:Button ID="inputButton" runat="server" Text="Enter Count" OnClick="InputButton_Click" /></td>
                </tr>
            </table>
        </fieldset>
    </asp:Panel>
    <br />
    <br />
    <asp:Panel ID="amountPanel" runat="server" Visible="false" DefaultButton="printButton">
        <telerik:RadListView ID="amountList" runat="server" ItemPlaceholderID="amountPlaceHolder">
            <LayoutTemplate>
                <fieldset>
                    <legend>Money Order Amounts</legend>
                    <asp:Panel ID="amountPlaceHolder" runat="server"></asp:Panel>
                </fieldset>
            </LayoutTemplate>           
            <ItemTemplate>
                <center>
                    <table>
                        <tr>
                            <td align="right"><asp:Label ID="amountLabel" runat="server" Text="<%# Container.DataItem.ToString() %>" Font-Bold="true" Font-Size="Small"></asp:Label></td>
                            <td align="left"><telerik:RadNumericTextBox ID="amountBox" Width="150px" runat="server" NumberFormat-DecimalDigits="2" DataType="double"></telerik:RadNumericTextBox></td>                           
                        </tr>
                    </table>
                </center>       
            </ItemTemplate>
        </telerik:RadListView>           
        <br />
        <br />
        <center>
            <asp:CheckBox ID="suspFlag" runat="server" /><asp:Label runat="server" ID="suspText" Text="This order is suspicious" Font-Bold="true" Font-Size="Small"></asp:Label>
            <br />
            <asp:Button ID="printButton" runat="server" Text="Print Money Orders" OnClick="PrintButton_Click" />
        </center>           
    </asp:Panel>

Here is my server-side code:
public partial class MoneyOrder_Create : System.Web.UI.Page
{
    ACROrder order = ACRFunctions.Order;
    int moneyOrderCount = ACRFunctions.OrderCount;
    protected void Page_Load(object sender, EventArgs e)
    {
        ((AppMasterPage)Master).verNum = "3.5";
        ((AppMasterPage)Master).visibleHome = true;
        ((AppMasterPage)Master).AppName = "Money Order Creation";
        ((AppMasterPage)Master).visibleBreadCrum = true;
        ((AppMasterPage)Master).subMenuName = navLastMenu.GetMenuLineApps(navLastMenu.GetPreviousMenuID(Convert.ToInt32(Session["SessionMenuID"])));
        if (Request.QueryString["error"] != null)
            errorLabel.Text = Request.QueryString["error"];
    }
 
    protected void LookupButton_Click(object sender, EventArgs e)
    {
        order = ACRFunctions.GetACROrder(Convert.ToInt32(orderNum.Text), true);
        if (order.Order_No == -1)
            SetLookupText("Cannot Find Order in ACR", "", "");           
        else
        {
            if (ACRFunctions.OrderIsMoneyOrder(order))
            {
                if (!ACRFunctions.OrderIsUsed(order))
                {
                    SetLookupText("", ACRFunctions.GetMoneyOrderSum(order).ToString("C"), ACRFunctions.GetMoneyOrderFees(order).ToString("C"));
                    SetFocus(orderCount);
                    ACRFunctions.Order = order;
                    countPanel.Visible = true;
                }
                else
                    SetLookupText("This ACR Order has already been used to print money orders", "", "");               
            }
            else
                SetLookupText("Not a Valid Money Order Transaction", "", "");               
        }
    }
 
    public void SetLookupText(string errorText, string salesText, string feesText)
    {
        errorLabel.Text = errorText;
        orderSalesValue.Text = salesText;
        orderFeesValue.Text = feesText;
        if (salesText == "")
        {
            countPanel.Visible = false;
            amountPanel.Visible = false;
        }
    }
 
    protected void InputButton_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(orderCount.Text))
        {
            errorLabel.Text = "You Must Enter a Count";
            return;
        }
        else
        {
            moneyOrderCount = Convert.ToInt32(orderCount.Text);
            if (moneyOrderCount <= 0)
            {
                errorLabel.Text = "You Must Enter a Positive Number";
                amountList.DataSource = null;
                return;
            }
            errorLabel.Text = "";
            amountPanel.Visible = true;
            ArrayList list = new ArrayList();
            for (int i = 0; i < moneyOrderCount; i++)
            {
                list.Add("Amount " + (i + 1) + ": ");
            }
            amountList.DataSource = list;
            ACRFunctions.OrderCount = moneyOrderCount;           
        }
    }
 
    protected void PrintButton_Click(object sender, EventArgs e)
    {
        List<decimal> amounts = new List<decimal>();
        foreach (var item in amountList.Items)
        {
            if (string.IsNullOrEmpty(((item.FindControl("amountBox") as RadNumericTextBox).Text)))
            {
                errorLabel.Text = "You must enter an amount for each money order.  Change the count if you entered too many.";
                return;                                            
            }
            else if (Convert.ToDecimal((item.FindControl("amountBox") as RadNumericTextBox).Text) <= 0)
            {
                errorLabel.Text = "Money Order Amounts Must Be Greater than Zero.";
                return;                                            
            }
            else
                amounts.Add(Convert.ToDecimal((item.FindControl("amountBox") as RadNumericTextBox).Text));
        }
        Printer printer = new Printer();
        string error = printer.PrintMoneyOrders(amounts, ACRFunctions.Order, suspFlag.Checked, Session["SessionUserNum"].ToString(), Request.ServerVariables["REMOTE_ADDR"]);
        if (!string.IsNullOrEmpty(error))
            errorLabel.Text = error;
        else
            errorLabel.Text = "Print Successful";
    }
}

Thanks,
Aaron
Martin
Telerik team
 answered on 11 May 2011
3 answers
167 views
Hi, i have text allign issue in RadScheduler when the resources grouping direction is Vertical. The text is not fully displayed and the text is align to the left.
Here is the picture.


Could anyone please advice me ?
PLEASE !!
Peter
Telerik team
 answered on 11 May 2011
1 answer
86 views
Hi,
I am using telerilk rad grid to show details of employee name and ID with pagination. I also have a text box for employee name which should populate first employee name in the grid page. When i change the grid to second page, the text box should show the first name of second page. I am assigning the text box value in the ItemDataBound event. The value is assigned to the text box but it is not showing in the UI since the grid paging is done in AJAX and the page is not rendered. How to get the text box populate without rendering the whole page.
Thanks,
S, Karthi
Karthi
Top achievements
Rank 1
 answered on 11 May 2011
1 answer
60 views
I have several rad grids on an aspx page and I need to localize the builtin paging control tool tips (i.e Next page, Previous Page)  How do I do thet in VB (ASP.Net)   I have looked all over the web and can not find a concise answer anywhwer.

Thanks,


Gary Graham
Shinu
Top achievements
Rank 2
 answered on 11 May 2011
1 answer
65 views
Hello,

I have a Rad Grid and on it I have 2 filters.. The boss told me he wanted to use a button/image of [Search] and not the default icon that is used for Filtering... I figured out how to change the Icon to use an image via the code below:

.rgFilter 

  background:url('../images/search.gif') !important; 
}  

But when viewed in a browser it clips the image to the same size of the old Icon...

where to set this size/width??

View attached image to see the problem
or URL: http://tinyurl.com/4xzqbyu

Thanks
Shane
Shinu
Top achievements
Rank 2
 answered on 11 May 2011
2 answers
156 views

Hello


I need to set the ID of a repeated button in a RADGrid and then get that ID in the VB code on the server side when it is clicked.


Hers what I’m looking to do...

1) Using a  RADGrid I want a Button in one of the columns (Got it/Can do)

2) When that button is clicked it calls a set of code (function/sub) server side VB

  - I want to give each button a defend ID using the record ID in dataset the data set that’s building out the table for the grid.

  - The code that is called will be the same no matter what button in the list is clicked

  - The code it calls can know/get what button ID was clicked so that it may use the ID to drill in to the DB.
(I know how to do the DB work, just need the Button ID that was clicked, sever side VB)


-Problems/help??

   - I can’t see how to set the ID via the RADGrid designer

      -- I do see how to for "tool tip" and the like but not the button ID (not the button text)

   - Where do I set it to call a sub or function that I have in the VB code page?
   - What code would go in go in the Sub:

Sub GridButtonEdit()

   BtnClkd = Get.GridButtonEdit.ID
End Sub
--- Something like that???? ---


If it’s not possible to set the Button ID (as I see it’s some random long string now) then is there something I could set that I could then get in the code that it calls?


Thanks for the help!

Shane

Shane
Top achievements
Rank 1
 answered on 10 May 2011
2 answers
60 views
I have tried everything I can think of. Please see the attached image. I have a simple menu that willNOT overlay a test box below it.
The menu is within a <div><panel> menu  <panel><div>  and the text box is in another <div><panel> set. ccs dictates where on the form these grouping show. I have tried messing with the z-index and  overlay=true and all other kinds of things.
Help please

gollnick
Kate
Telerik team
 answered on 10 May 2011
2 answers
129 views
Greetings,
    Can the ActiveRegionToolTip of a RadChart be databound to a value returned directly from a datasource?  I am able to set it to the X or Y value in the Chart datapoint using #Y, etc., but if the query is returning extra text in a different field, is there a way to directly feed that into the ActiveRegionToolTip?  (i.e., without resorting to server side code when the items are databound).

Thanks
Dave
David
Top achievements
Rank 1
 answered on 10 May 2011
3 answers
118 views
I searched the forum and couldn't find anything that fixed my problem, so I'm posting it now in hopes of getting an answer. This is my problem: I am using RadWindow as a popup modal login. The window opens without any problems and I can perform the login without any problems. The issue is when the RadWindow closes. I keep getting an error saying that the javascript method is undefined. This is the relevant code:

<telerik:RadWindow ID="dlgLogin" runat="server" Behaviors="Close" ReloadOnShow="true" OnClientClose="RadWindowOnClientClose" BackColor="Gray" Modal="true" Height="250"></telerik:RadWindow>

function RadWindowOnClientClose(radWindow) {
                document.location.pathname = "/DaytonDefense/Web/Public/Default.aspx";
            }

Now when I change the inside of the function to something like 'window.location.reload' it works without any problems. Also, if I put that line inside another function and call it from a button click it works fine as well, it just won't work in the OnClientClose function. I can't figure out what I'm doing wrong, help please!
Andrew
Top achievements
Rank 1
 answered on 10 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?