Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
147 views

Hello,

I have two objects. Resource (Id, Quantity, AgencyId, Agency), and Agency (Id, Name)

I made a grid that represents resources, and i want the user to edit them using the batch edit mode.

For the AgencyId, i want the user to choose from a dropdownlist.

When the user hit save, i can get the value of the Quantity but the value of AgencyId is Empty.

 

Here is my html. im i missing some thing ??

<telerik:RadGrid ID="AgenciesGrid" runat="server" AutoGenerateColumns="False" Height="280px">
               <ClientSettings EnableAlternatingItems="False">
                   <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                   <Selecting AllowRowSelect="true"/>
               </ClientSettings>
               <MasterTableView CommandItemDisplay="Top" HorizontalAlign="NotSet" EditMode="Batch" DataKeyNames="Id"
                                ClientDataKeyNames="Id" SelectMethod="GetAssociatedAgencies" UpdateMethod="UpdateAssociation"
                                InsertMethod="InsertAssociation" DeleteMethod="DeleteAssociation"
                                >
                   <Columns>
                       <telerik:GridTemplateColumn HeaderText="Agency" UniqueName="AgencyId" DataField="AgencyId">
                          <ItemTemplate>
                               <%# Eval("Agency.Name") %>
                           </ItemTemplate>
 
                           <EditItemTemplate>
                                <telerik:RadDropDownList runat="server" SelectMethod="GetAgencies" DataValueField="Id"
                                    DataTextField="Name" Width="200" />
                           </EditItemTemplate>
                       </telerik:GridTemplateColumn>
 
 
                       <telerik:GridNumericColumn HeaderText="Quantity" DataField="Quantity" DecimalDigits="0"/>
 
                        
                   </Columns>
               </MasterTableView>
           </telerik:RadGrid>

Kedjour
Top achievements
Rank 1
 answered on 10 Sep 2015
1 answer
92 views

Hi,

     We have a issue with scheduler in Ipad. If we select the moth view and try to create a appointment , it automatically ​navigates to day view. This issue is only in ipad in desktop version it works as expected. Can some  one helps to resolve this issue.  Thanks in advance!!.

 

Dimitar
Telerik team
 answered on 10 Sep 2015
3 answers
240 views

Hi,

I have upgraded the Telerik version from 2014.1 to 2015.2. Now getting an error for Jquery. As I found there are two multiple solutions:

1) Disable the UnobtrusiveValidationMode

2) Add definition for JQuery in global.asax.

 

If I choose the first option, will it affect any new functionality I will get from 2015.2 ? Which one do you recommend ?

 

Regards

Cavit
Top achievements
Rank 1
 answered on 10 Sep 2015
5 answers
521 views
I have a web application in which I generate Telerik RadGrids programatically based on some definition. Some of our datasets require custom template columns for which I have created special subclasses of GridTemplateColumn.

Some of the functions I currently override to support single selection filtering:
protected override void SetupFilterControls(TableCell cell)
 {
    base.SetupFilterControls(cell);
    cell.Controls.RemoveAt(0);
 
    var filterList = new RadComboBox();
    filterList.Width = FilterControlWidth;
    filterList.DropDownAutoWidth = RadComboBoxDropDownAutoWidth.Enabled;
    filterList.AutoPostBack = true;
    filterList.SelectedIndexChanged += filterList_SelectedIndexChanged;
    filterList.Items.Add(new RadComboBoxItem("", ""));
 
    // COMBO BOX IS POPULATED HERE -- CODE REMOVED
 
    cell.Controls.AddAt(0, filterList);
}
 
protected override void SetCurrentFilterValueToControl(TableCell cell)
{
    base.SetCurrentFilterValueToControl(cell);
    if (CurrentFilterValue != "")
    {
        (cell.Controls[0] as RadComboBox).SelectedValue = CurrentFilterValue;
    }
}
 
protected override string GetCurrentFilterValueFromControl(TableCell cell)
{
    return (cell.Controls[0] as RadComboBox).SelectedValue;
}
 
private void filterList_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    GridFilteringItem filterItem = (GridFilteringItem)((RadComboBox)sender).NamingContainer;
 
    filterItem.FireCommandEvent("Filter", new Pair("EqualTo", UniqueName));
}

Everything here works as I expected, I am able to filter the grids by selecting an item in the radcombo box.

My question is, how can I modify this code to allow multiple selections (via the checkbox feature of the radcombo) and have my grid filter to contain the rows with any of the selected values?

The issue would seem to be with the filterItem.FireCommmandEvent. There doesn't seem to be a way to indicate an "IN" filter or ".Contains" in LINQ syntax. Is what I am trying to do not possible? I've see the example solution referenced in other threads, but that involves editing the filter expressions on the grid directly. Is that something I can do from the column itself?
Eyup
Telerik team
 answered on 10 Sep 2015
1 answer
237 views

Hi, i have a problem. 

I'm using a RadDropDownList in RadGrid when in Edit Mode. But i can't bind the datatable of list to the RadDropDownList.

here's my RadGridCode

<telerik:RadGrid ID="radGridTarget" GridLines="None" runat="server" AllowAutomaticDeletes="True"
    AllowAutomaticInserts="True" PageSize="10" Height="250px" Width="500px"
    OnItemDeleted="radGridTarget_ItemDeleted" OnItemInserted="radGridTarget_ItemInserted"
    OnItemUpdated="radGridTarget_ItemUpdated" AllowAutomaticUpdates="True" AllowPaging="True"
    AutoGenerateColumns="False" onitemdatabound="radGridTarget_ItemDataBound" >
    <MasterTableView CommandItemDisplay="Top" HorizontalAlign="NotSet" EditMode="InPlace" AutoGenerateColumns="False">
    <NoRecordsTemplate>
        <table width="100%" border="0" cellpadding="20" cellspacing="20">
            <tr>
                <td align="center">
                    <h2 style="color:Black">No Data</h2>
                </td>
            </tr>
        </table>
     </NoRecordsTemplate>
    <PagerStyle Mode="NumericPages"/>
        <BatchEditingSettings EditType="Cell" />
        <Columns>
            <telerik:GridBoundColumn DataField="Sales" HeaderText="Sales" Display="false"></telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderText="Target" DefaultInsertValue="Target" HeaderStyle-Width="150px" UniqueName="Target" DataField="Target">
                <ItemTemplate>
                    <%# Eval("Target") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDropDownList runat="server" ID="radDropDownTarget" DataValueField="Value" DataTextField="Target" ></telerik:RadDropDownList>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridNumericColumn DataField="Amount" HeaderStyle-Width="80px" HeaderText="Target Amount" SortExpression="Amount" UniqueName="Amount">
            </telerik:GridNumericColumn>
            <telerik:GridButtonColumn ConfirmText="Delete this target?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" HeaderText="Delete"
                HeaderStyle-Width="50px" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
            </telerik:GridButtonColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings AllowKeyboardNavigation="true"></ClientSettings>
</telerik:RadGrid>

and this is how i bind the RadDropDownList, and not working

protected void radGridTarget_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem editItem = (GridEditableItem)e.Item;
        RadDropDownList dropDown = (RadDropDownList)editItem.FindControl("radDropDownTarget");
        dropDown.DataSource = _presenter.PopulateTargetList();
        dropDown.DataTextField = "Value";
        dropDown.DataValueField = "Desc";
        dropDown.DataBind();
    }
}
 

Please help me. Thank you in advance

Eyup
Telerik team
 answered on 10 Sep 2015
1 answer
211 views

Dear Telerik Team,

I want to import data from different websites with HTML Agility Pack. Then I want to export data to my SQL database. I have little problem because every cell return my "&nbsp" . I use method from this website:
http://www.telerik.com/forums/access-cell-values-in-radgrid-selected-index-event

So I think that problem is in import data.

I attach 2 sample code."Row" file return me correct data, but return me the same problem. I think that "Cell" sample code should return me correct data but in every rows display the same information. 

Cell Code: 

    WebClient webClient = new WebClient();
            StreamReader page = new StreamReader(WebRequest.Create("http://nolimits.art.pl/grafik/wyswietl.php?typ=2").GetResponse().GetResponseStream(), Encoding.UTF8);

            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.Load(page);

            HtmlNode node = doc.DocumentNode.SelectSingleNode("//table");
            string context = node.InnerHtml;
            DataTable NLTable = new DataTable();
            //NLTable.Columns.Add(" ");//CheckBox
            NLTable.Columns.Add("Dzien tygodnia");
            NLTable.Columns.Add("Godziny zajec");
            NLTable.Columns.Add("Nazwa zajec");
            NLTable.Columns.Add("Poziom");
            NLTable.Columns.Add("Instruktor");
            NLTable.Columns.Add("Wolne miejsce dla");
            foreach (HtmlNode row in node.SelectNodes("tr"))
            {
                if (row.InnerText != "" && row.InnerHtml.IndexOf("<th>") < 0 && row.InnerHtml.IndexOf("background-color") < 0)
                {
                    TableRow tRow = new TableRow();                   
                    foreach (HtmlNode cell in row.SelectNodes("td"))
                    {
                        TableCell tCell = new TableCell();
                        tCell.Text = cell.InnerText;
                        tRow.Cells.Add(tCell);
                    }
                    NLTable.Rows.Add(tRow);
                }
            }
            rgSynchronize.DataSource = NLTable;
            rgSynchronize.DataBind();
        }

 

Cell Sample code:

WebClient webClient = new WebClient();
            //string page = webClient.DownloadString("http://nolimits.art.pl/grafik/wyswietl.php?typ=1");
            StreamReader page = new StreamReader(WebRequest.Create("http://nolimits.art.pl/grafik/wyswietl.php?typ=2").GetResponse().GetResponseStream(), Encoding.UTF8);

            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.Load(page);

            HtmlNode node = doc.DocumentNode.SelectSingleNode("//table");
            string context = node.InnerHtml;
            DataTable NLTable = new DataTable();
            NLTable.Columns.Add(" ");//CheckBox
            NLTable.Columns.Add("Dzien tygodnia");
            NLTable.Columns.Add("Godziny zajec");
            NLTable.Columns.Add("Nazwa zajec");
            NLTable.Columns.Add("Poziom");
            NLTable.Columns.Add("Instruktor");
            //NLTable.Columns.Add("Nr sali");
            NLTable.Columns.Add("Wolne miejsce dla");
            foreach (HtmlNode row in node.SelectNodes("tr"))
            {
                if (row.InnerText != "" && row.InnerHtml.IndexOf("<th>") < 0 && row.InnerHtml.IndexOf("background-color") < 0)
                    NLTable.Rows.Add(row.InnerHtml);
            }
            rgSynchronize.DataSource = NLTable;
Angel Petrov
Telerik team
 answered on 10 Sep 2015
1 answer
184 views

hello, I have a radgrid with a linkbutton column "Edit". I want to call a modalextenderpopup when a user clicks the Edit button using Javascript. But it is not working:

<telerik:RadGrid ID="RadGrid_Search" runat="server" AllowPaging="True"
            AllowSorting="True" GroupPanelPosition="Top"  PageSize="30"
        ResolvedRenderMode="Classic" HorizontalAlign="Right"
            ondeletecommand="RadGrid_Search_DeleteCommand"
        onitemdatabound="RadGrid_Search_ItemDataBound"
        oneditcommand="RadGrid_Search_EditCommand">
            <MasterTableView Width="100%"  DataKeyNames="UPC">
            <EditFormSettings>
                <PopUpSettings Modal="true"/>
            </EditFormSettings>
            <Columns>
            <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete" ConfirmText="AA"></telerik:GridButtonColumn>
            <telerik:GridButtonColumn UniqueName="EditColumn" Text="Edit" CommandName="Select" ></telerik:GridButtonColumn>
            </Columns>
            </MasterTableView>
            <ClientSettings>
                <Selecting AllowRowSelect="True" />
            </ClientSettings>
            <HeaderStyle Font-Bold="True" Font-Names="Verdana" />
            <ItemStyle Font-Names="Verdana" />
                                  
        </telerik:RadGrid>
 
<cc1:ModalPopupExtender ID="popup" BehaviorID="popup1" runat="server" DropShadow="false"
        PopupControlID="pnlAddEdit" TargetControlID="lnkDummy" BackgroundCssClass="modalBackground" OkControlID="btnYes" >
    </cc1:ModalPopupExtender>

Code Behind:
if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            string contactName = dataItem["Album Name"].Text;
 
            LinkButton button = dataItem["DeleteColumn"].Controls[0] as LinkButton;
            button.Attributes["onclick"] = "return confirm('Are you sure you want to delete " +
            contactName + "?')";
 
            LinkButton btnEdit = dataItem["EditColumn"].Controls[0] as LinkButton;
            btnEdit.Attributes["onclick"] = "return ShowModalPopup()";
        }

Javascript code :
function ShowModalPopup() {
           try
           {
               $find("popup1").show();               
           }
           catch (err) {
               alert(err.message);
           }
           return false;
       }


Please advice. Thank you

Eyup
Telerik team
 answered on 10 Sep 2015
0 answers
192 views

I've searched and seen this several times before but I'm just stumped. I know i've got to be missing something simple.

 Here's my scenario. I have 4 RadTextBoxes in a Panel along with a Search button and a Reset button. I have EmptyText values set for each of them.  What I'd like is to have the Search button Disabled until someone enters at least one character into at least one of the TextBoxes (we allow partial matches). We had it working before sort of, until the EmptyText values were set.  Like I said, I know i'm missing something stupid but here's the basic code:

 

Javascript:

  function formValidation(oEvent) {
                oEvent = oEvent || window.event;
                var txtField = oEvent.target || oEvent.srcElement;
                var ShouldEnabled = true;
                if (document.getElementById("ctl00_Body_uxMemberFirstName").value.length == 0 || document.getElementById("ctl00_Body_uxMemberFirstName").value.length != 17)
                { ShouldEnable = false; }
                if (document.getElementById("ctl00_Body_uxMemberLastName").value.length == 0 || document.getElementById("ctl00_Body_uxMemberLastName").value.length != 16)
                { ShouldEnable = false; }
                if (document.getElementById("ctl00_Body_uxMemberId").value.length == 0 || document.getElementById("ctl00_Body_uxMemberId").value.length != 15)
                { ShouldEnable = false; }
                if (document.getElementById("ctl00_Body_uxMemberId").value.length == 0 || document.getElementById("ctl00_Body_uxMemberId").value.length != 25)
                { ShouldEnable = false; }
                if (ShouldEnabled) { document.getElementById("ctl00_Body_uxSearch_input").disabled = false; }
                else { document.getElementById("ctl00_Body_uxSearch_input").disabled = true; }
            }

 ---------------

 window.onload = function () {
            var txtMemberFirstName = document.getElementById("ctl00_Body_uxMemberFirstName");
            var txtMemberLastName = document.getElementById("ctl00_Body_uxMemberLastName");
            var txtMemberId = document.getElementById("ctl00_Body_uxMemberId");
            var txtMemberOldId = document.getElementById("ctl00_Body_uxMemberId");
            var ShouldEnabled = false;
            document.getElementById("ctl00_Body_uxSearch_input").disabled = true;
            txtMemberFirstName.onkeyup = formValidation;
            txtMemberLastName.onkeyup = formValidation;
            txtMemberId.onkeyup = formValidation;
            txtMemberOldId.onkeyup = formValidation;
        }

 

----------------------Then the code for the Telerik controls is:

   <telerik:RadButton ID="uxSearch" runat="server" Text="Search" Width="55px" OnClick="uxSearch_Click"
                            ToolTip="Search" TabIndex="13" ValidationGroup="SearchMember" OnClientClicked="validateInput" />

 

I've set the uxSearch's Enabled property to False at Page load and on Pre-Render on a whim, set it inline in the code above, and everything else I can think of. I've tried it in multiple browsers and verified that the properties are set correctly via the debugger.  I actually want to use similar behavior throughout the app with RibbonButtons but need to start here. We have code in the code behind that'll stop the search from happening if there aren't values in.  I wasn't here for it but from what i understand,  I 'broke' the code when I entered the EmptyText values for each of the relevant textbox controls which I believe was being handled with the validateinput method (not shown here b/c I don't think it's relevant).

 

Again, this has to be very common functionality and I'm not a UI guy (in fact my field is Data Science so doing UI stuff is way out of my league. No one else was able to get any traction though on any of the other items even though this one supposedly worked before so I was hoping to solve it here and use the same logic throughout. i beg your indulgence if this is such a newbie question and honestly, I did spend quite a while searching and trying things .  I'm attaching the relevant files if that could help (although I'm certainly not asking anyone to debug my code).  I just have a nagging suspicion I'm overlooking something really small and being new to Javascript I'm sure that's the case. Any help would be greatly appreciated.​​

 

Bill
Top achievements
Rank 1
 asked on 10 Sep 2015
12 answers
2.5K+ views
hi,
I have a problem with the Radbutton control ......
Code:
telerik:RadButton ID="btnStandard" runat="server" Text="Standard Button"
        OnClientClicked="return confirm('Do u want to save')" OnClick="btnStandard_Click" UseSubmitBehavior="false"    ></telerik:RadButton>

I added a OnClientClicked event to the radButton......Now here is the problem

At first a confirmation comes "Do you want to save"......Now if i press yes or No ....it still does a postback .In the asp.net button clientClick if  return false it doesn't do a post back......

wht is the solution to that...Plz help me......

Thank's
Fathima
Top achievements
Rank 1
 answered on 10 Sep 2015
2 answers
54 views
how can I validate using RadInputManager the textbox generated by Gridboundcolumn? As much as possible I dont want to create a form template. Thanks.
Ben
Top achievements
Rank 1
 answered on 09 Sep 2015
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?