Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
440 views
I want to bind states combo box based on which country is selected but when i try to do that programmatically i get the following error
"There is no assigned data source. Unable to complete callback request."

Here is my code
<telerik:RadComboBox ID="ddlState" runat="server" AllowCustomText="true" MaxHeight="100px" EnableAutomaticLoadOnDemand="true"></telerik:RadComboBox>
    public void fillState(long countryId)
    {
        g_frontendDataContext fdc = new g_frontendDataContext();
        try
        {
            var states = from i in fdc.tbl_sfl_states
                         where i.fk_country_id == countryId
                         select new
                         {
                             stateId = i.pk_state_id,
                             stateName = i.state_name
                         };
            ddlState.DataSource = states.ToList();          
            ddlState.DataBind();           
            ddlState.DataTextField = "stateName";
            ddlState.DataValueField = "stateId";          
            fdc.Dispose();
        }
}
Ivana
Telerik team
 answered on 23 Dec 2011
3 answers
109 views
Hi ,

I have given the attribute like this
HeaderStyle-CssClass="tdheaderblue"
 ItemStyle-CssClass="tdheaderbluefirst"


where the tdheaderblue is a css class


.tdheaderblue th
{
background-color: #d5e2e9;
height: 16px;
color: #414141;
font-size: 12px;
border-right: 1px solid White;
padding: 3px 10px 3px 10px;
text-align: center;
}


but the items are able to pickup the css, but the header is not able to pickup the css.


Can any one please help me out ?


Thanks in advance !


regards,
Prasad Jidugu

Pavlina
Telerik team
 answered on 23 Dec 2011
0 answers
123 views
Hi
I have a grid with  CommandItemTemplate.there are button in CommandItemTemplate for example Insert button ,Save button ,etc
when i am in edit mode and i click save button there is an erro.code in save button is here

 

 

 

protected void dgdZone_InsertCommand(object sender, GridCommandEventArgs e)

 

{

 

 

Hashtable newValues = new Hashtable();

 

 

 

GridEditableItem editedItem = e.Item as GridEditableItem;

 

e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);

objZone.SelectAll();

 

 

if (objZone.dtblZone.Select("strName='" + newValues["strName"].ToString() + "'").Length == 0)

 

{

objZone.StrName = newValues[

 

"strName"].ToString();

 

objZone.StrAddress = newValues[

 

"strAddress"].ToString();

 

objZone.Insert();

}

 

 

else

 

{

}

}

 newValues is null therefor cause this error
Object reference not set to an instance of an object.
my code page is here


 

<

 

 

body>

 

 

 

 

 

 

 

 

<form id="form1" method="post" runat="server">

 

 

 

 

 

 

 

 

<div>

 

 

 

 

 

 

 

 

 

<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">

 

 

 

 

 

 

 

 

</telerik:RadScriptManager>

 

 

 

 

 

 

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

 

 

 

 

 

 

 

<AjaxSettings>

 

 

 

 

 

 

 

 

<telerik:AjaxSetting AjaxControlID="dgdZone">

 

 

 

 

 

 

 

 

<UpdatedControls>

 

 

 

 

 

 

 

 

<telerik:AjaxUpdatedControl ControlID="dgdZone" />

 

 

 

 

 

 

 

 

</UpdatedControls>

 

 

 

 

 

 

 

 

</telerik:AjaxSetting>

 

 

 

 

 

 

 

 

</AjaxSettings>

 

 

 

 

 

 

 

 

</telerik:RadAjaxManager>

 

 

 

 

 

 

 

 

<telerik:RadGrid ID="dgdZone" runat="server" AutoGenerateColumns="False" MasterTableView-Dir="RTL"

 

 

 

CellSpacing="0" GridLines="None" Width="50%" AutoGenerateHierarchy="True"

 

 

 

Skin="Outlook" onneeddatasource="dgdZone_NeedDataSource"

 

 

 

oninsertcommand="dgdZone_InsertCommand"

 

 

 

onupdatecommand="dgdZone_UpdateCommand" ondeletecommand="dgdZone_DeleteCommand">

 

 

 

 

 

 

 

 

<ClientSettings>

 

 

 

 

 

 

 

 

<Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />

 

 

 

 

 

 

 

 

</ClientSettings>

 

 

 

 

 

 

 

 

<ExportSettings FileName="ErikaGridExport">

 

 

 

 

 

 

 

 

</ExportSettings>

 

 

 

 

 

 

 

 

<ClientSettings>

 

 

 

 

 

 

 

 

<Selecting AllowRowSelect="True" />

 

 

 

 

 

 

 

 

</ClientSettings>

 

<

 

 

MasterTableView HierarchyLoadMode="Client" CommandItemDisplay="Top" Dir="RTL" EditMode="EditForms" Font-Names="Tahoma">

 

<

 

 

CommandItemTemplate>

 

 

 

 

 

 

 

 

 

<telerik:RadButton ID="btnEdit" CommandName="EditSelected" runat="server" Skin="Office2007" Font-Names="tahoma" Font-Size="8.5pt" Visible='<%# dgdZone.EditIndexes.Count == 0 %>' Text="ویرایش">

 

 

 

 

 

 

 

 

</telerik:RadButton>

 

 

 

 

 

 

 

 

<telerik:RadButton ID="btnCancel" CommandName="CancelAll" runat="server" Skin="Office2010Blue" Font-Names="tahoma" Font-Size="8.5pt" Text="انصراف" Visible='<%# dgdZone.EditIndexes.Count > 0 || dgdZone.MasterTableView.IsItemInserted %>'></telerik:RadButton>

 

 

 

<telerik:RadButton ID="btnSave" CommandName="UpdateEdited" runat="server" Skin="Office2010Blue" Font-Names="tahoma" Font-Size="8.5pt" Text="ذخیره" Visible='<%# dgdZone.EditIndexes.Count > 0 %>'></telerik:RadButton>

 

 

 

<telerik:RadButton ID="btnNew" CommandName="InitInsert" runat="server" Skin="Office2010Blue" Font-Names="tahoma" Font-Size="8.5pt" Text="منطقه جدید" Visible='<%# !dgdZone.MasterTableView.IsItemInserted %>'></telerik:RadButton>

 

 

 

<telerik:RadButton ID="btnSaveNewItem" CommandName="PerformInsert" Skin="Office2010Blue" Font-Names="tahoma" Font-Size="8.5pt" runat="server" Text="ثبت منطقه جدید" Visible='<%# dgdZone.MasterTableView.IsItemInserted %>'></telerik:RadButton>

 

 

 

<telerik:RadButton ID="btnDelete" CommandName="DeleteSelected" Skin="Office2010Blue" Font-Names="tahoma" Font-Size="8.5pt" runat="server" Text="حذف"></telerik:RadButton>

 

<%

 

--<telerik:RadToolBar ID="RadToolBar1" runat="server" OnClientButtonClicking="onToolBarClientButtonClicking" OnButtonClick="RadToolBar1_ButtonClick" Skin="Outlook">

 

<Items>

 

<telerik:RadToolBarButton Text="ویرایش" Font-Names="Tahoma" CommandName="EditSelected" ImageUrl="StyleStandars/Images/users_into.png" Visible='<%# dgdZone.EditIndexes.Count == 0 %>'></telerik:RadToolBarButton>

<telerik:RadToolBarButton Text="ذخیره" CommandName="UpdateEdited" ImageUrl="StyleStandars/Images/users_into.png" Visible='<%# dgdZone.EditIndexes.Count > 0 %>'></telerik:RadToolBarButton>

<telerik:RadToolBarButton Text="انصراف" CommandName="CancelAll" ImageUrl="StyleStandars/Images/users_into.png" Visible='<%# dgdZone.EditIndexes.Count > 0 || dgdZone.MasterTableView.IsItemInserted %>'></telerik:RadToolBarButton>

<telerik:RadToolBarButton Text="منطقه جدید" CommandName="InitInsert" ImageUrl="StyleStandars/Images/users_into.png" Visible='<%# !dgdZone.MasterTableView.IsItemInserted %>'></telerik:RadToolBarButton>

<telerik:RadToolBarButton Text="ثبت منطقه جدید" CommandName="PerformInsert" ImageUrl="StyleStandars/Images/users_into.png" Visible='<%# dgdZone.MasterTableView.IsItemInserted %>'></telerik:RadToolBarButton>

<telerik:RadToolBarButton Text="حذف" CommandName="DeleteSelected" ImageUrl="StyleStandars/Images/users_into.png"></telerik:RadToolBarButton>

<telerik:RadToolBarButton Text="بازآوری" CommandName="RebindGrid" ImageUrl="StyleStandars/Images/users_into.png"></telerik:RadToolBarButton>

</Items>

</telerik:RadToolBar>--

 

 

%>

 

 

 

</CommandItemTemplate>

 

 

 

 

 

 

<

 

 

CommandItemSettings ExportToPdfText="Export to PDF" ShowExportToExcelButton="True"

 

 

 

ShowExportToPdfButton="True"></CommandItemSettings>

 

 

 

 

 

 

<

 

 

RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">

 

<

 

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

 

RowIndicatorColumn>

 

 

 

 

 

 

<

 

 

ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">

 

<

 

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

 

ExpandCollapseColumn>

 

 

 

 

 

 

 

 

<Columns >

 

 

 

 

 

 

 

 

<telerik:GridTemplateColumn DataField="strName"

 

 

 

FilterControlAltText="Filter strName column" HeaderText="نام منطقه"

 

 

 

UniqueName="strName">

 

 

 

 

 

 

 

 

<EditItemTemplate>

 

 

 

 

 

 

 

 

 

<telerik:RadTextBox ID="strNameTextBox" Skin="Office2010Blue" Font-Names="Tahoma" Text='<%# Bind("strName") %>' runat="server">

 

 

 

 

 

 

 

 

</telerik:RadTextBox>

 

 

 

 

 

 

 

 

</EditItemTemplate>

 

 

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

 

 

<asp:Label ID="strNameLabel" runat="server" Text='<%# Eval("strName") %>'></asp:Label>

 

 

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

 

 

<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />

 

 

 

 

 

 

 

 

<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />

 

 

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="iNumber"

 

 

 

FilterControlAltText="Filter iNumber column" UniqueName="iNumber"

 

 

 

ForceExtractValue="Always" Visible="False" ReadOnly="True">

 

 

 

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

 

 

<telerik:GridTemplateColumn DataField="strAdress"

 

 

 

FilterControlAltText="Filter strAdress column" HeaderText="آدرس"

 

 

 

UniqueName="strAddress">

 

 

 

 

 

 

 

 

<EditItemTemplate>

 

 

 

 

 

 

 

 

 

<telerik:RadTextBox ID="strAdressTextBox" Skin="Office2010Blue" Width="400px" Font-Names="Tahoma" Text='<%# Bind("strAddress") %>' runat="server">

 

 

 

 

 

 

 

 

</telerik:RadTextBox>

 

 

 

 

 

 

 

 

</EditItemTemplate>

 

 

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

 

 

<asp:Label ID="strAdressLabel" runat="server" Text='<%# Eval("strAddress") %>'></asp:Label>

 

 

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

 

 

<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="400px" />

 

 

 

 

 

 

 

 

<ItemStyle Width="400px" />

 

 

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="iParentNumber"

 

 

 

FilterControlAltText="Filter iParentNumber column" ForceExtractValue="Always"

 

 

 

UniqueName="iParentNumber" Visible="False" ReadOnly="True">

 

 

 

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

 

 

</Columns>

 

 

 

 

 

 

 

 

<EditFormSettings>

 

<

 

 

EditColumn UniqueName="EditCommandColumn1" Visible="false" ButtonType="PushButton" InsertText="ذخیره" UpdateText="ذخیره"

 

 

 

 

 

 

 

 

CancelText="انصراف"></EditColumn>

 

 

 

 

 

 

 

 

<FormMainTableStyle Font-Names="tahoma" Font-Size="9pt"/>

 

 

 

 

 

 

 

 

<FormTableStyle Font-Names="tahoma" Font-Size="9pt"/>

 

 

 

 

 

</

 

 

EditFormSettings>

 

 

 

 

 

 

 

 

<EditItemStyle Font-Names="Tahoma" />

 

<

 

 

EditFormSettings>

 

<

 

 

EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>

 

</

 

 

EditFormSettings>

 

</

 

 

MasterTableView>

 

 

 

 

 

 

<

 

 

FilterMenu EnableImageSprites="False">

 

<

 

 

WebServiceSettings>

 

<

 

 

ODataSettings InitialContainerName=""></ODataSettings>

 

</

 

 

WebServiceSettings>

 

</

 

 

FilterMenu>

 

 

 

 

 

 

<

 

 

HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">

 

<

 

 

WebServiceSettings>

 

<

 

 

ODataSettings InitialContainerName=""></ODataSettings>

 

</

 

 

WebServiceSettings>

 

</

 

 

HeaderContextMenu>

 

 

 

 

 

 

 

 

</telerik:RadGrid>

 

 

 

 

 

 

 

 

</div>

 

 

 

 

 

 

 

 

</form>

 

</

 

 

body>
Please help to me
Thanks

 

Salman
Top achievements
Rank 1
 asked on 23 Dec 2011
2 answers
168 views
I have a class that inherits from GridBoundColumn (TextFilterButtonColumn.cs) in order to add some custom filtering. I then use TextFilterButtonColumn to create columns within a RadGrid. I would like to add a click event to each item in the column. I've done the following within TextFilterButtonColumn.cs:

public override void Initialize()
{
    base.Initialize();
    Owner.Page.ClientScript.RegisterClientScriptResource(this.GetType(), "Common.js");
}
public override void PrepareCell(TableCell cell, GridItem item)
{
    base.PrepareCell(cell, item);
    if (!(item is GridDataItem)) return;
    var clickScript = string.Format("javascript:tfbc_Click('{0}','{1}');", this.Owner.ClientID, CommandName);
    var linkButton = new HtmlAnchor() { ID = "lnk", InnerText = cell.Text, HRef = clickScript };
    cell.Controls.Clear();
    cell.Controls.Add(linkButton);
}

In the Common.js file I have the following function:

function tfbc_Click(owner, command, argument) {
    $find(owner).fireCommand(command, argument);
}

This click event is then accessed inside of the RadGrid ItemCommand event by setting the CommandName property of the GridBoundColumn to "commandName" and checking for it:

if(e.CommandName == "commandName")
{
    var item = (GridDataItem) e.Item;
    var strKey = item.GetDataKeyValue("Id").ToString();
    var control = (Details)Page.LoadControl("~/Controls/Details.ascx");
    control.Id = long.Parse(strKey);
    MPS.AddPopup(control);
}

I was hoping to access the Id of the row that the radgrid is bound to by calling GetDataKeyValue however this always returns 1. Is there a way to access information regarding the datasource for that row in the ItemCommand event? Or is there another way to accomplish this? Thanks.
Joseph
Top achievements
Rank 1
 answered on 23 Dec 2011
1 answer
153 views
hi

ClientEvents-OnRequestStart and  ClientEvents-OnResponseEnd is not working if the controls that i am calling is inside the panel that is disabled and i cannot postback the page using my submit button

For example

ClientEvents-OnRequestStart="ClearNameMsg" ClientEvents-OnResponseEnd="RadManagerResponseEnd"
      function ClearNameMsg() {     
                  document.getElementById("<%=CustomDomainTxt.ClientID %>").disabled = true;
                  document.getElementById("<%=SubDomainTxt.ClientID %>").disabled = true;
              }

         function RadManagerResponseEnd() {
                  document.getElementById("<%=CustomDomainTxt.ClientID %>").disabled = false;
                 document.getElementById("<%=SubDomainTxt.ClientID %>").disabled = false;
              }

one of the two textboxes are inside a panel that is disabled. when i click the button submit. I cannot proceed. when i commented out this
       document.getElementById("<%=CustomDomainTxt.ClientID %>").disabled = false;
                 document.getElementById("<%=SubDomainTxt.ClientID %>").disabled = false;
      document.getElementById("<%=CustomDomainTxt.ClientID %>").disabled = true;
                  document.getElementById("<%=SubDomainTxt.ClientID %>").disabled = true;

Everything is working fine again. any help
Andrey
Telerik team
 answered on 23 Dec 2011
1 answer
288 views
Is there a graceful way to prevent a form from being submitted while there is a file uploading via RadAsyncUpload?  I'm not fond of disabling the submit button or anything of that nature.  I'm thinking more along the lines of allowing the submit button to be clicked, and a loading panel displays until the file is finished uploading and the form is submitted.  I'm using ajax, so I need to use the AsyncUpload (otherwise I'd just use RadUpload and be done with it).  Any suggestions?
Dimitar Terziev
Telerik team
 answered on 23 Dec 2011
7 answers
260 views
I would like to customize the InsertTable dropdown tool by removing much of the functionality. I just want the tool to allow users to add a table, and add/delete rows and columns. I want to remove the table wizard and all the formatting capabilities (fonts, sizes, colors, backgrounds, borders, etc.).

I see the dialog code for each of the details (Table Wizard, Table Properties, Cell Properties) but I don't see anywhere that I can change the dropdown. Is that possible?


OK, I made progress on this. The InsertTable item is a button, so there isn't any dialog and it's not a dropdown, so I can't remove child items. I edited the TableWizard dialog, set the whole table to display:none, and added a div above the table with text that says these features are not available. So that meets my immediate need, because all the settings I don't want are in the TableWizard dialog.

So now the question is less urgent, because I have most of a solution. Does anyone know if there's any way to remove the Table Wizard, Table Properties and Cell Properties links from the InsertTable button? It would be better if the user could not make an invalid choice. But this doesn't seem likely to be something I can modify.
Richard
Top achievements
Rank 1
 answered on 23 Dec 2011
3 answers
106 views
Hello,

I am using a grid that opens for editing.  I am using "editforms" for EditMode.  However, it loads the controls vertically when the grid opens for editing.  I have a several controls so I would like to display them side by side (horizontally).  Is that possible?

Thanks,
Tom
Thomas
Top achievements
Rank 1
 answered on 23 Dec 2011
3 answers
126 views
Hello All,

my filter is combobox: template with 2 columns instead of value 'All' is empty (see Attachment). It works correctly.
how can I get value 'All' on the top.

<telerik:GridTemplateColumn DataField="Type"
            FilterControlAltText="Filter TypeName column" HeaderText="<%$Resources:Texte, Type%>"
            SortExpression="Type" UniqueName="Type">
           <ItemTemplate>
              <asp:Label ID="Label1" runat="server" ToolTip='<%#Bind("TypeName")%>' Text='<%# Bind("Type") %>'></asp:Label>
           </ItemTemplate>
 
            <FilterTemplate>
                <telerik:RadComboBox ID="RadComboBoxCode" DataSourceID="SqlDataSource2" DataTextField="Code" Width="100px"
                    DataValueField="Code" Height="100px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Type").CurrentFilterValue %>'
                    runat="server" OnClientSelectedIndexChanged="TypeIndexChanged" DropDownWidth="350px">
                    <Items>
                        <telerik:RadComboBoxItem Text="All"/>
                    </Items>
                    <ItemTemplate>
                        <table style="width: 300px" cellspacing="0" cellpadding="0">
                            <tr>
                                <td style="width: 80px;">
                                        <%# Eval("Code")%>
                                </td>
                                <td style="width: 200px;">
                                    <%# Eval("CName")%>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:RadComboBox>
                <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
 
                    <script type="text/javascript">
                        function TypeIndexChanged(sender, args) {
                            var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                            tableView.filter("Type", args.get_item().get_value(), "EqualTo");
                        }
                    </script>
 
                </telerik:RadScriptBlock>
            </FilterTemplate>
        </telerik:GridTemplateColumn>
Marcus
Top achievements
Rank 1
 answered on 23 Dec 2011
1 answer
46 views
Hi ,


I have implemented a page with multiple rad panes and splitters. The Panes are adjusted according to my monitor resolution. (as it is not accepting the height and width values in terms of percentage)

The issue is..

When it was opened on another screen resolution, everything appears quite ugly.(due to the width and height of the panes)

can you please provide us a solution where the size of the panes should adjust according to the screen of the monitor.

Thanks in advance !,


regards,
Prasad.
Svetlina Anati
Telerik team
 answered on 23 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?