Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
114 views
Hello People.
Im trying to get id of selected row as asp.net code bellow:

                    <telerik:RadGrid ID="grdProCodes" OnPreRender="grdProCodes_PreRender" AllowMultiRowSelection="true" Visible="true" AutoGenerateColumns="false"
                        runat="server">
                        <ClientSettings EnableRowHoverStyle="true">
                            <Selecting AllowRowSelect="true" />
                        </ClientSettings>

                        <MasterTableView>
                            <Columns>
                                <telerik:GridClientSelectColumn DataTextField="Id" UniqueName="idItemSelected" HeaderStyle-Width="50"
                                    HeaderText="#">

                                </telerik:GridClientSelectColumn>
                                <telerik:GridBoundColumn DataField="CorpDiscountNumber" HeaderStyle-Width="150" HeaderText="Corp. Discount Number">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PromotionCode" HeaderStyle-Width="150" HeaderText="Promotional Code">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PromotionalTitle" HeaderText="Descrição">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="StartDate" HeaderStyle-Width="150" HeaderText="Data Inicial"
                                    DataFormatString="{0:dd/MM/yyyy}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="EndDate" HeaderStyle-Width="150" HeaderText="Data Final"
                                    DataFormatString="{0:dd/MM/yyyy}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Active" HeaderStyle-Width="100" HeaderText="Ativo">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>

When I click in button to do a Post Back in my page, my RadGrid can't detect all my checkbox is checked as the follow code bellow:

                foreach (GridDataItem itemGrid in grdProCodes.MasterTableView.Items)
                {
                    if (itemGrid.Selected)
                    {
                        int idItemSelected = Convert.ToInt32(itemGrid["idItemSelected"]);
                    }
                }

Best Regards,

Milton Camara

Pavlina
Telerik team
 answered on 23 Dec 2011
2 answers
165 views
I'm implementing an interface similar to the one shown here:

http://demos.telerik.com/aspnet-ajax/treelist/examples/itemsdragdrop/defaultcs.aspx 

and I am able to fire an event that has all the information about the dragged item that I need in my code behind. However I'm struggling trying to find out what item the item was dropped on. I need to accomplish this because I need to know whether to a) add the new item as a child of the parent when dropped on an outer node, or b) add the new item as a sibling after the drop target when dropped on an inner node. I also need the identity (some clientDataKeyItem?) for the drop target so that I act on it in the code behind. Any help on this would be appreciated.

Steve
neebs
Top achievements
Rank 2
 answered on 23 Dec 2011
0 answers
65 views
Hello, 

Can any one help me on How to Filter the Rad grid; One of the column as drop down list binded. all other columns are having normal telerik filter.   Everything records should filter dynamically. I am using entity framework 4.1. 



 
Lakshman
Top achievements
Rank 1
 asked on 23 Dec 2011
3 answers
75 views
All,

I have a grid which I dynamically create on server side.
As the Grid populates a large number of entries, I use custom pagine to retrieve only few rows at a time.
The problem is that Fitering is not working correctly when used with custom paging. The filter only filters data that appears in the current dataset (displayed page) and so provides only part of the actual number of rows that should return.
I tried using the technique displayed in http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx, but the example do not work for me and in fact it seems that it is not working correctly at all.

Any ideas?

Regards,
Tzach.
Pavlina
Telerik team
 answered on 23 Dec 2011
1 answer
433 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
106 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
92 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
161 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
149 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
284 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?