Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
252 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
223 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
236 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
70 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
5 answers
236 views

On the menu control you can ".Target" on a RadMenuItem.

 

How do I do that for a navigation control?

I have a few items that I want to open into a new tab rather than redirecting.

 

Thanks

Ivan Danchev
Telerik team
 answered on 09 Sep 2015
2 answers
136 views
How do I hide the week number and the 'X'. I used ShowRowHeaders="false" and it got rid of the actual week numbers, but the X and empty first column still show and that looks worse. I just want one column for each day of the week. Thanks!
DogBizPro
Top achievements
Rank 1
 answered on 09 Sep 2015
1 answer
195 views

Hello,

Is there in your opinion a way to make Magic Zoom Plus (https://www.magictoolbox.com/voila/) working with BinaryImage (images stored in a database) ?

It should be great to get them run together or at last having a close functionality with BinaryImage.

Thanks for your reply,

 

 Herve

Konstantin Dikov
Telerik team
 answered on 09 Sep 2015
4 answers
257 views

Hi,

I am not sure if this is a job for the RadButton or a checkbox but I want to know if it is possible to have a control styled like the iPhone's On/Off slider button?

Danail Vasilev
Telerik team
 answered on 09 Sep 2015
1 answer
71 views

Hai.

I have a problem regarding  passing parameter from radwindow template field to sqldatasource. here is eg. given below. but its not working. 

here is a scenario (A)

 

<div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>" 
            SelectCommand="SELECT * FROM [SalesPerson] WHERE ([TerritoryID] = @TerritoryID)">
            <SelectParameters>
                <asp:ControlParameter ControlID="TextBox1" Name="TerritoryID" 
                    PropertyName="Text" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <telerik:RadWindow ID="RadWindow1" runat="server">
            <ContentTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Height="21px" 
    Width="60px"></asp:TextBox>
            </ContentTemplate>
        </telerik:RadWindow>
     </div>​

 

 

datasource does not recorgnised the textbox1. because of that field under radwindow template.

 

would any one help me how to recorgnise  that textbox1 in sqldatasource parameter.  

 

with regard 

Rama

 

rama
Top achievements
Rank 1
 answered on 09 Sep 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?