Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
105 views

Hi All,

Let me start off by saying I am a noob when it comes to using asp.net and telerik. With that being said I am having an issue updating the headers of the rad grid. When I run the application in Visual Studio the headers are correct, however when I build the solution and run the application on the internet the headers still reflect the old text (before the text change).The  application in question was built by someone else using asp.net, c#, javascript, ajax, etc. I am pretty sure the version of telerik used originally is much older than the version I am using today which is the most current version as of 9/15/15 . I should also mention there are two versions of the application one being used now by employees and one I am working on a development sever. The header text that should be changed should be both the Approval and Status text.

I added two images below to show you what the app looks like in visual studio vs what it looks when run on the internet.

 Code ASCX:

<telerik:RadGrid ID="HistoryCard" runat="server" OnNeedDataSource="HistoryCard_NeedDataSource" OnItemDataBound="HistoryCard_ItemDataBound">
 
        <MasterTableView AutoGenerateColumns="false">
                    <Columns>
                        <telerik:GridBoundColumn HeaderText="Due Date" DataField="due_date" DataFormatString="{0:MM/dd/yyyy}" />
                        <telerik:GridBoundColumn HeaderText="Inspection Dates" DataField="inspection_date" DataFormatString="{0:MM/dd/yyyy}" />
            <telerik:GridTemplateColumn HeaderText="Status" UniqueName="Status">
                            <ItemTemplate>
                                <%# Common.EquipmentStatus.GetLabel(Eval("current_use")) %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Approval" UniqueName="Approval">
                            <ItemTemplate>
                                <%# Common.HistoryStatus.GetLabel(Eval("status")) %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Adjusted">
                            <ItemTemplate>
                                <%# GiTools.DataTypes.Bool.Format(Eval("adjusted"), "Yes", "No") %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn HeaderText="Remarks:" DataField="remarks" ItemStyle-CssClass="history_card_links" />
                        <telerik:GridTemplateColumn HeaderText="Inspector">
                            <ItemTemplate>
                                <%# GiTools.Mail.MailHelper.MakeMailToLink(null, null, Eval("email"), Eval("name")) %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
             
 
 
                    </Columns>
                </MasterTableView>
 
       
            </telerik:RadGrid>

James
Top achievements
Rank 1
 answered on 24 Sep 2015
3 answers
104 views

Hi community,

I have a several RadDatePicker and one RadMonthYearPicker control on a simple page.

I was trying to hide some of them by condition through client side event only, so I write a handler and try to use client object methods to hide them.

 My handler looks like:

function handler(){
    alert("before");
    $find("<%= RadDatePicker1.ClientID %>").set_visible(false);
    $find("<%= RadMonthYearPicker1.ClientID %>").set_visible(false);
    alert("after");
}

Both alert message pop up without any javascripts error, but none of the control is hidden...

This is my first trial, then I try to work around with get_textBox() and hide the text box rendered.

 

function handler2(){
    alert("before");
    $($find("<%= RadDatePicker1.ClientID %>").get_textBox()).hide();
    $($find("<%= RadMonthYearPicker1.ClientID %>").get_textBox()).hide();
    alert("after");
}

Now the DatePicker is hidden but not the MonthYearPicker...

What have I do wrong and how can I achieve such easy tasks?

I am using Telerik Ajax 2012.1.411, and my browser is Chrome & IE8+

Thanks!

Viktor Tachev
Telerik team
 answered on 24 Sep 2015
1 answer
67 views

I can find no way to properly format my source code samples here on this forum. The painbrush icon (Format Code Block) simply doesn't work, and never has. Begging everyone's pardon, could you please see my question on Stack, which formats code samples nicely. If anyone can tell me how to properly format my code blocks here on this forum, I am happy to learn.

 

http://stackoverflow.com/questions/32737055/telerik-radgrid-codebehind-doesnt-recognize-rows-added-via-javascript

 

Thanks very much.​

Viktor Tachev
Telerik team
 answered on 24 Sep 2015
6 answers
151 views

I have a RadGrid with that works correctly outside of the RadPanelBar.  When I put it inside of a RadPanelBar the OnCheckedChanged="ToggleRowSelection" does not fire.  Does "protected void ToggleRowSelection(object sender, EventArgs e)" need to be defined differently?  It looks like the auto post back works because the check mark disappears.  If I remove ToggleRowSelection in the c# section I get a compile error indicating that there is no definition for ToggleRowSelection so I think it is all correct. 

 Thanks,

 Scott

<telerik:RadPanelBar ID="RadPanelBar1" Runat="server" Width="774px">
       <Items>
           <telerik:RadPanelItem runat="server" Text="Web Servers">
                   <ContentTemplate>
                       <telerik:RadGrid ID="WebServerRadGrid" runat="server" AllowPaging="True" PageSize="5" Skin="Silk" AllowMultiRowSelection="true">
                          <MasterTableView>
                              <Columns>
                                <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                                 <ItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="ToggleRowSelection" AutoPostBack="True" />
                                 </ItemTemplate>
                              </telerik:GridTemplateColumn>
                            </Columns>
                          </MasterTableView>
                       </telerik:RadGrid>
                   </ContentTemplate>
           </telerik:RadPanelItem>
        </Items>
   </telerik:RadPanelBar>

 

 

protected void ToggleRowSelection(object sender, EventArgs e)
  {
      ((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
      bool checkHeader = true;
      foreach (GridDataItem dataItem in WebServerRadGrid.MasterTableView.Items)
      {
          if (!(dataItem.FindControl("CheckBox1") as CheckBox).Checked)
          {
              checkHeader = false;
              break;
          }
      }
      GridHeaderItem headerItem = WebServerRadGrid.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
      (headerItem.FindControl("headerChkbox") as CheckBox).Checked = checkHeader;
  }

Ivan Danchev
Telerik team
 answered on 24 Sep 2015
3 answers
346 views

 Grid is not refreshed after ItemCommand event

 

 

Protected Sub Parts_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles Parts.ItemCommand
If e.CommandName = "DeleteInventory" Then
Dim filename As String = _uploadSystemPath & "tree.xml"
Dim XMLDoc As XDocument = XDocument.Load(_uploadSystemPath & "tree.xml")
XMLDoc.Root.Elements("Node")(e.Item.ItemIndex).Remove()
XMLDoc.Save(filename)
XMLBookBuilderSource.DataFile = _uploadSystemPath & "tree.xml"
Parts.DataSource = XMLBookBuilderSource
Parts.DataBind()
End If
End Sub

Viktor Tachev
Telerik team
 answered on 24 Sep 2015
2 answers
394 views
Hi Team,

I am Using RadCombobox and List box and a button in a page. Radcombobox has selected index changed event. Filling listbox in this event . I am checking some items (not all) from code behind file after clicking button then Select index change event is firing before button click event. If i select all the elements from the code behind file then it is going well(button click event only fires). please give suggestion/solution as soon as possible for selectedindexchanged event occurring UN eventually.

Thanks,
Prasad.
Hari
Top achievements
Rank 1
 answered on 24 Sep 2015
1 answer
384 views

UI for ASP.NET AJAX version: 2015.1.225

I'm trying to grab information from the radgrid when the user selects a row.  The Javascript function fires as expected, but I can't seem to get the right syntax to grab the cell information.

    <script type="text/javascript">
        function launchDetails(sender, eventArgs) {

        }
    </script>

If I use 'sender.MasterTableView.getColumnByUniqueName("caseName");' I get the column information as expected.
If I use 'parseInt(eventArgs.get_itemIndexHierarchical());' I get the selected row index as expected.

If I use 'sender.MasterTableView.getCellByColumnUniqueName(parseInt(eventArgs.get_itemIndexHierarchical()),"caseName");' I get the following error:
'Uncaught TypeError: a.get_element is not a function(…)' at 'Telerik.Web.UI.GridTableView.getCellByColumnUniqueName'

I've also tried this line of code without the 'parseInt', but obtain the same results.  How can I grab the "caseName" at the designated clicked row?

Viktor Tachev
Telerik team
 answered on 24 Sep 2015
1 answer
102 views
Is there a way for me to validate the filename for any special characters and cancel the upload if it contains any special characters?
Ivan Danchev
Telerik team
 answered on 24 Sep 2015
1 answer
173 views

 

I have an external button that needs to call my UpdateCommand event, but I am not sure how to do it.  Here is what I have so far:

protected void RadGrid2_UpdateCommand(object sender, GridCommandEventArgs e)
{
     String connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["KBConnectionString"].ConnectionString;
     try
     {
          string answerid = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["AnswerID"].ToString();
 
          using (SqlConnection conn = new SqlConnection(connectionString))
          {
               conn.Open();
               SqlCommand cmd = new SqlCommand("UPDATE Answers SET Answer_Name = @prmAnswer_Name, Answer = @prmAnswer, TimeAdded = CURRENT_TIMESTAMP WHERE AnswerID = " + answerid, conn);
               cmd.Parameters.Add(new SqlParameter("@prmAnswer_Name", RadTextBox1.Text));
               cmd.Parameters.Add(new SqlParameter("@prmAnswer", RadEditor.Text));
               cmd.ExecuteNonQuery();
               conn.Close();
          }
     }
     catch (Exception)
     {
          RadScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('There was a problem finding the ID, please contact support.')", true);
     }
}
Button click:

protected void RadButton2_Click(object sender, EventArgs e)
{           
     //CommandEventArgs cea = new CommandEventArgs(RadTextBox1.Text, RadEditor.Text);
     //GridCommandEventArgs args = new GridCommandEventArgs(null, "Edit", cea);
     //RadGrid2_UpdateCommand(sender, args);
}
 How do I call the UpdateCommand event from the external button click?

Konstantin Dikov
Telerik team
 answered on 24 Sep 2015
2 answers
71 views

Hello,

there are nice and proper examples for adding an extra input field for each upload of a file in the onClientFileUploaded event.
Like here: http://demos.telerik.com/aspnet-ajax/asyncupload/examples/additionalfields/defaultcs.aspx

But how do i add a second ?

Tried this but failed with a jQuery error :(

function onClientFileUploaded(radAsyncUpload, args) {
            var $row = $(args.get_row());
            var inputName = radAsyncUpload.getAdditionalFieldID("TextBox");
            var inputID = inputName;
            var input = createInput(inputID, inputName);
            var label = createLabel(inputID);
                
            $row.append("<br/>");
            $row.append(label);
            $row.append(input);

            var $row2 = $(args.get_row());
            var inputName2 = radAsyncUpload.getAdditionalFieldID("SelectBox");
            var inputID2 = inputName2;
            var input2 = createDocTypeInput(inputID2, inputName2);
            $row2.append("<br/>");
            $row2.append(label)
            $row2.append(input2);
        }

Any help is highly appreciated.

 

Ivan Danchev
Telerik team
 answered on 24 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?