Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
83 views
Hi,

I have an web user control having a radwindow and a radgrid within it. I want to invoke this user control from multiple pages which means I want to show the popup(radwindow) from multiple pages. Could you please guide me how i cn achieve this. Now I am creating an instance of the user control in the calling form and finding the radwindow from the user control.But it is not finding the radwindow from the user control.It is giving null when I am trying to find the radwindow from the user control.

Thanks.
Princy
Top achievements
Rank 2
 answered on 14 Feb 2012
3 answers
578 views

The data binding event in this code isn't working any longer.  I was testing a custom node template and using the code from this page (add and edit templates Runtime), but then removed all the code specific to the custom node template.  At that point, the data stopped binding.  I have added the code back, moved all of it to another page, but the data binding event doesn't seem to fire.  Even with all the test code from the linked page above in my page, if I set a breakpoint in the DataBinding function it never gets hit.  If I manually place a RadTreeView on the .aspx page it will display, but anything set on the server side will not.

I have checked to make sure List used to populate the tree has data, and this line (radTree.DataSource = treeNodes) works correctly.  But the databind is still failing.

Any suggestions?

Thanks,
Peter

namespace FQRSurvey.Controls  
{  
   public partial class TreeViewControl : System.Web.UI.UserControl  
   {  
      protected void Page_Load(object sender, EventArgs e)  
      {  
         if (!this.Page.IsPostBack)  
         {  
            //load tree view  
            Survey survey = SurveyController.GetSurveyByID(new Guid("6C685FBA-1380-47B7-A911-DC89AF9479CF"));  
            CreateRadTree(survey, questionTree);  
         }  
      }  
      protected override void OnInit(EventArgs e)  
      {  
         questionTree.NodeTemplate = new SectionTemplate();  
         //questionTree.NodeTemplate = new QuestionTemplate();  
         //questionTree.NodeTemplate = new AnswerTemplate();  
         base.OnInit(e);  
      }  
 
      protected void RadTreeView1_HandleDrop(object sender, RadTreeNodeDragDropEventArgs e)  
      {  
         RadTreeNode sourceNode = e.SourceDragNode;  
         RadTreeNode destNode = e.DestDragNode;  
         RadTreeViewDropPosition dropPosition = e.DropPosition;  
 
         if (destNode != null)  
         {  
            if (sourceNode.TreeView.SelectedNodes.Count <= 1)  
            {  
               if (!sourceNode.IsAncestorOf(destNode))  
               {  
                  sourceNode.Owner.Nodes.Remove(sourceNode);  
                  destNode.Nodes.Add(sourceNode);  
               }  
            }  
 
            destNode.Expanded = true;  
            sourceNode.TreeView.ClearSelectedNodes();  
         }  
      }  
 
      private void CreateRadTree(Survey survey, RadTreeView radTree)  
      {  
         radTree.NodeTemplate = new SectionTemplate();  
 
         if (!survey.Sections.Count.Equals(0))  
         {  
            List<TreeNode1> treeNodes = new List<TreeNode1>();  
            Sections sections = survey.Sections;  
 
            //Loop through Sections  
            for (int i = 0; i < sections.Count; i++)  
            {  
               Section section = sections[i];  
               //Create Section Node  
               TreeNode1 sNode = new TreeNode1(section.SectionID.ToString(), String.Empty, section.SectionTitle, section.SectionStatus);  
               treeNodes.Add(sNode);  
 
               //Get Questions  
               if (section.FirstQuestion != null)  
               {  
                  Question q = section.FirstQuestion;  
                  string prevNode = String.Empty;  
 
                  if (q.PrevAnswer == null) prevNode = sNode.ID;  
                  else prevNode = q.PrevAnswer.AnswerID.ToString();  
 
                  //Create Question Node  
                  TreeNode1 qNode = new TreeNode1("q" + q.FriendlyID, prevNode, q.QuestionText, SurveyStatus.Active);  
                  //Create Answer Group  
                  treeNodes.Add(qNode);  
               }  
            }  
 
            radTree.DataTextField = "Text";  
            radTree.DataFieldID = "ID";  
            radTree.DataFieldParentID = "ParentID";  
            radTree.DataSource = treeNodes;  
            radTree.DataBind();  
         }  
      }  
   }  
 
 
   internal class TreeNode1  
   {  
      private string _id;  
      private string _text;  
      private SurveyStatus _status;  
      private string _parentID;  
 
      public string ID  
      {  
         get { return _id; }  
         set { _id = value; }  
      }  
 
      public string ParentID  
      {  
         get { return _parentID; }  
         set { _parentID = value; }  
      }  
 
      public string Text  
      {  
         get { return _text; }  
         set { _text = value; }  
      }  
 
      public SurveyStatus Status  
      {  
         get { return _status; }  
         set { _status = value; }  
      }  
 
      public TreeNode1(string id, string parentID, string text, SurveyStatus status)  
      {  
         _id = id;  
         _text = text;  
         _status = status;  
         _parentID = parentID;  
      }  
   }  
 
   class SectionTemplate : ITemplate  
   {  
      public void InstantiateIn(Control container)  
      {  
         Label label1 = new Label();  
         label1.Font.Size = 15;  
         label1.DataBinding += new EventHandler(label1_DataBinding);  
         container.Controls.Add(label1);  
      }  
 
      private void label1_DataBinding(object sender, EventArgs e)  
      {  
         Label target = (Label)sender;  
         RadTreeNode node = (RadTreeNode)target.BindingContainer;  
         string nodeText = (string)DataBinder.Eval(node, "Text");  
         target.Text = nodeText;  
      }  
   }  
 


Update:
From additional digging and messing around, the problem relates to converting a Guid to a string to be used as the ID field.  I'm not sure why it won't accept the Guid as a string, but using an int instead of string fixes the problem.  Any reason convertinting a Guid to a string would cause the data to fail to bind without any errors?
Robin
Top achievements
Rank 1
 answered on 14 Feb 2012
1 answer
97 views
How to change the text of first item "Check all which is generated automatically?
Princy
Top achievements
Rank 2
 answered on 14 Feb 2012
1 answer
127 views
How can i access checkbox in toolbar button click?
aspx:
<telerik:RadToolBar ID="RadTool" runat="server" AutoPostBack="true" onbuttonclick="RadTool_ButtonClick" >
 <Items>
    <telerik:RadToolBarButton runat="server" Text="Edit"></telerik:RadToolBarButton>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</telerik:RadToolBarButton>
</Items>
</telerik:RadToolBar>
Princy
Top achievements
Rank 2
 answered on 14 Feb 2012
2 answers
256 views
I am using RADGrid probably a little differnt than the typical - edit one item, update, save, repeat. I am using the RadGrid mainly because of its ability to maintain state on postback from the server.
I am having trouble looping through the grid from a OnCheckChange function/process.

So I have a Parent / Child Grid setup.  I do have more values assigned, but for simplicity I provided the sample above.  What I am doing is when the check box within the Parent or Child grid is selected I am running a routine - but I am having trouble looping through the vaules.  Below is what I am attempting.  Can someone assist with where I am missing?



Public Sub CheckBoxParent(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
  
For Each item As GridDataItem In rParent.Items  
 
    Dim myCheckbox As CheckBox = DirectCast(item.FindControl("CheckBoxParent"), CheckBox)
 
    Dim hAttributeID As HiddenField = DirectCast(dataItem.FindControl("hAttributeID"), HiddenField)
 
 
  ' Child radGrid
   Dim dg As Telerik.Web.UI.RadGrid = item.FindControl("radChild")
 
        ' trying to Loop through each DataGridItem of the child grid
        For Each dgItem As GridDataItem In dg.Items
     
    Next
 
Next
 
End Sub
 
<telerik:RadGrid id="rParent" runat="server" AllowMultiRowSelection="True">
 <MasterTableView ShowHeader="true" AutoGenerateColumns="false">
<Columns>
<telerik:GridTemplateColumn>
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
    <asp:CheckBox id="CheckBoxParent" OnCheckedChanged="findScore"
AutoPostBack="True" runat="server"></asp:CheckBox>
    <%# DataBinder.Eval(Container.DataItem, "KeyID") %>
<asp:HiddenField ID="hAttributeID" runat="Server" Value='<%# DataBinder.Eval(Container.DataItem, "AttributeID") %>' />
 
    <telerik:RadGrid id="rChild" runat="server">
    <MasterTableView ShowHeader="false" AutoGenerateColumns="false">
    <Columns>
    <telerik:GridTemplateColumn>
    <ItemTemplate>
    <%# DataBinder.Eval(Container.DataItem, "Description") %>
    <%# DataBinder.Eval(Container.DataItem, "AttributeID") %>
 
    <asp:CheckBox id="CheckBoxChild" OnCheckedChanged="findScore"
AutoPostBack="True"  runat="server"></asp:CheckBox>
 
    </ItemTemplate>
   </telerik:GridTemplateColumn>
    </Columns>
    </MasterTableView>
   <ClientSettings EnableRowHoverStyle="false" EnablePostBackOnRowClick="true" />
    </telerik:RadGrid>
 
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>





 

 

 

 

 

 

 

 

Shinu
Top achievements
Rank 2
 answered on 14 Feb 2012
0 answers
220 views

Hi all,

i am facing problem to closing clorbox when record is successfully inserted, my scenerio is follows

i am currently working on web application and using asp.net, c# and jquery languages, i have designed registration form and open into iframe so i have palced all input fields which is required in registration process like username, email, password etc. it is working fine when i am clicking on user registration anchor than register.aspx page is open in lightbox or popup window but light box not closed when user is successfully inserted. so how can i close it on successfully record insertion rather than cliking on close button.

i have also tried to close write this line $.colorbox.close(); on register.aspx page on submit click but it is not working ..

kindly helpout me.

i have written following code to open light box  and this is URL which i have implement in my project

URL:::::  http://jacklmoore.com/colorbox/

<asp:Content ID="Content2" ContentPlaceHolderID="cph_body" runat="server">    <link href="../Styles/colorbox.css" rel="stylesheet" type="text/css" />    <script src="../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>    <script src="../Scripts/jquery.colorbox.js" type="text/javascript"></script>        <div class="content-body">                                <div style="padding-bottom: 10px;">                            <a class='UserRegistration' href="Register.aspx" title="User Registration"><span>                               New User Registred Here</span></a>                        </div>                               </div>    </div>        <script type="text/javascript">        jQuery(document).ready(function () {            jQuery(".UserRegistration").colorbox({ iframe: true, width: "580", height: "480", onClosed: function () { location.reload(true); } });            jQuery("#cboxClose").click(function () {                location.reload();            });        });        function CloseColorBox() {            $.colorbox.close();            location.reload();        }    </script></asp:Content>

kd
Top achievements
Rank 1
 asked on 14 Feb 2012
1 answer
125 views
Hi Telerik Team!

I want to show image in RadTreeList from Database that store in bytes form, like we do have GridBinaryImageColumn in RadGrid.
Shinu
Top achievements
Rank 2
 answered on 14 Feb 2012
1 answer
421 views
i have a grid and iam doing sum on the footer for the column but the word "sum" is also showing with the actual integer sum, how do i remove that
Princy
Top achievements
Rank 2
 answered on 14 Feb 2012
3 answers
215 views
Hi All,

I have a tabstrip with 5 tabs 
I need validation group for every single TABs.
I want to acheive the below result

When i click on the second tab, only the FIRST tab needs to be validated
When i click on the third tab, only the SECOND tab needs to be validated and so on.

and  If i'm in second tab, and clicked the FIRST tab, i dont want to consider whether SECOND tab is validated or not, i just want to move to FIRST tab

Help me out of this guys

Manivannan
Top achievements
Rank 1
 answered on 14 Feb 2012
4 answers
674 views
Hi

As per this old thread for winforms controls (http://www.telerik.com/community/forums/winforms/combobox/alignment-of-wide-text-in-radcombobox.aspx) I need to left-align the text in a combobox, rather than right-align, after it is selected.

I have this code which works for ie9, but unfortunately I need it to also work for ie7 (o I hate u ie7 so much)
<telerik:RadComboBox ID="RadComboBox1" runat="server"
   Width="150px" DropDownWidth="300px"
   OnClientSelectedIndexChanged="AlignLeftAfterSelectedIndexChange">
</telerik:RadComboBox>
 
function AlignLeftAfterSelectedIndexChange(sender) {
    var input = sender.get_inputDomElement();
    input.setSelectionRange(0, 0);
}

Is there a more Telerik-friendly way to do it?

Cheers
Jeremy
Top achievements
Rank 1
 answered on 14 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?