Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
224 views
Hi All,
I am working on this task for past 2 days and could not solve this problem. I have a radgrid with a column of linkbutons inside it. when a user clicks on any link button, I pop up a javascript message based on some conditions.
ScriptManager.RegisterStartupScript(Page, this.GetType(), "message", string.Format("confirm_select('{0}','{1}');", RadGrid_IDPicker.ClientID,row.RowIndex + 1), true);

inside the function confirm_select, I have to make one row bold, the row that user clicked on and make the previous bolded row as normal/unbolded.
To achieve this, I am looping though the radgrid and unbolding all the rows and bolding the currenlty selected row if the user presses ok, but if the user pressed cancel, I would leave the previous row as bolded. below is my code
<script type="text/javascript"> 
var selectedRowIndex = -1;
    function confirm_select(gridViewID, rowIndex) {
        debugger;
  
  
        var gridview = document.getElementById(gridViewID);
        var master = gridViewID.get_masterTableView();
          
        if (confirm("You are leaving the parent level of the currently selected ID, are you sure?") == true) {
  
            for (var i = 1; i < gridview.rows.length; i++) {
                //not the selected row
                if (i != rowIndex)
                    gridview.rows[i].style.fontWeight = 'normal';
                //selected row
                else {
                    gridview.rows[i].style.fontWeight = 'bold';
                    selectedRowIndex = rowIndex;
                }
            }
  
        }
        else {
            if (selectedRowIndex != -1)
                gridview.rows[selectedRowIndex].style.fontWeight = 'bold';
  
        }
    }
  
</script>

I am getting an error right here

 

 

var master = gridViewID.get_masterTableView();

 


I would not have done the get get_masterTableView(), but I could not loop thorugh the gridview rows to make them bolded or unbolded. Below is the code for my gridview.
I also tried

var master = gridview.get_masterTableView();
but above line of code didn't work either.

<telerik:RadGrid ID="RadGrid_IDPicker" AllowSorting="True" PageSize="100" AllowPaging="True"
                                        runat="server" GridLines="None" OnPageIndexChanged="RadGrid_IDPicker_PageIndexChanged"
                                       OnPageSizeChanged="RadGrid_IDPicker_PageSizeChanged" Width="1500px" Visible="false" OnItemDataBound="RadGrid_IDPicker_DataBound"  >
                                        
                                       <MasterTableView RetrieveAllDataFields="true" AutoGenerateColumns="false" DataKeyNames="ID" >
                                           <Columns>
                                               <telerik:GridTemplateColumn UniqueName="TemplateLinkColumn"  AllowFiltering="false" HeaderText="ID">
                                                
                                                   <ItemTemplate>
                                                       <asp:LinkButton ID="ID_Link" runat="server" OnClick="MCLID_Link_Click" Text='<%#Bind("ID") %>' CommandName="Bold"></asp:LinkButton>
                                                     
                                                   </ItemTemplate>
                                                     
                                               </telerik:GridTemplateColumn>
                                                  <telerik:GridTemplateColumn    HeaderText="TAG">
                                                   <ItemTemplate>
                                                      <asp:Label ID="lbltag" runat="server" Text='<%#Bind("TAG") %>'></asp:Label>
                                                     
                                                   </ItemTemplate>
                                           </Columns>
                                       </MasterTableView>
                                       <PagerStyle Mode="NextPrevAndNumeric" />
                                   </telerik:RadGrid>

I don't have anything else defined. this gridview is inside the radPanelbar so the whole gridview is enclosed in this

<telerik:RadPanelBar ID="RadPanelBar1" runat="server" Width="1500px" BackColor="#E6E6E6" ExpandMode="MultipleExpandedItems">
    <Items>
        <telerik:RadPanelItem runat="server" Text="ID Picker" Expanded="true" >
            <Items>
                <telerik:RadPanelItem Text="" Expanded="true">
                    <ItemTemplate>
                              //radgrid is right here

i am not sure what am I doing wrong, but I spend lot of hours on it and this is not working.

Any help will be highly appreciated.
Iana Tsolova
Telerik team
 answered on 22 Aug 2011
1 answer
163 views
Hi,

I have relatively simple scenerio where I have to check some conditions before updating data. To manage data I'm using RadGrid with autoupdate. I would like to check some conditions before update (i.e. if the name already exists, if an issue date is greater then other max issue date in database etc.). What is the best practice to make such check and how to stop update if some conditions are not met?
I thought about SqlDataSource updating event but I don't know how to read values from controls in edit form of RadGrid. Maybe other event is much more efficient in this case. I appreciate your support in this case as well as snippet of example code is welcome.

Best Regards,

Darek
Iana Tsolova
Telerik team
 answered on 22 Aug 2011
5 answers
190 views
i have a RadGrid in a usercontrol.
i have an aspx page that contains the usercontrol and a RadFilter.
how can i assign the FilterContainerID of the RadFilter to the RadGrid?

i already tried to directly giving it the ID as such:

 

<telerik:RadFilter 

ID="rfCustomFilter" runat="server"FilterContainerID="RadGrid1"/>

and i have also tried to assign filterContainerID in code behind as such:
rfCustomFilter.FilterContainerID = "RadGrid1";

both did not work, and i get an error when Adding an expression:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Devman
Top achievements
Rank 1
 answered on 21 Aug 2011
4 answers
102 views
At RadGrid.ItemCreated() event, that button is already created.

At which event, the CommandItem (export to excel button) is created and added to the MasterTableView?

I'd need to add a custom button to the CommandItem.

Thanks,


Daniel
Telerik team
 answered on 21 Aug 2011
2 answers
133 views
 

Hi

How could I export the TreeList data to an excel sheet?

Regards
Kannan
Daniel
Telerik team
 answered on 21 Aug 2011
3 answers
200 views
I have the following table
<table>
    <tr>
        <td>First Row, Cell 1</td>
        <td>First Row, Cell 2</td>
    </tr>
    <tr>
        <td colspan="2">Second Row, Cell 1</td>
    </tr>
</table>

Can some suggest a RadGrid equivalent that allows me to keep the second row but the cells in the first row become GridBoundColumns?  I think it has to be GridBoundColumn, because this allows sorting by column.

J
Daniel
Telerik team
 answered on 21 Aug 2011
1 answer
91 views
I've got another RadGrid problem. One column in my grid is a DropDown that is getting its values from a SqlDataSource. The cell is defined as:
<telerik:GridDropDownColumn DataField="store" HeaderText="Store" UniqueName="store" DataSourceID="SqlDataSource2"
       ListTextField="store" ListValueField="store">
</telerik:GridDropDownColumn>

The drop down list is getting populated fine. I am using edit in place for the editing and can select a value from the list okay. On the back end for the update, I've got (in part):
protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {           
        string store = (editedItem["store"].Controls[0] as DropDownList).SelectedValue.ToString();
    }

I'm getting an error at run time after editing a row when I include that code. If I remove the code that adds the store drop down from the update, it works fine (but of course doesn't update that field.) I've tried other variations such as "string store = (editedItem["store"].Controls[0] as DropDownList).SelectedItem.Value" with no luck.

The error is "Message: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
Line: 6
Char: 62099
Code: 0"

Any ideas? Thanks!
Susan
Top achievements
Rank 1
 answered on 20 Aug 2011
5 answers
947 views
Respected Sir/Madam,

I need to show checkboxes in one ComboBox. Now I want Server Side postback event, when user selects all desired checkboxes and clicks outside of ComboBox to close the ComboBox window. Is it possible? Currently SelectedIndexChanged is not working in this case. 

ASPX code:

 <telerik:RadComboBox runat="server" ID="ddlPopulation"  OnSelectedIndexChanged ="ddlPopulation_SelectedIndexChanged"
  OnItemDataBound="ddlPopulation_ItemDataBound" AllowCustomText="false" AutoPostBack="true" >
      <ItemTemplate>
            <asp:CheckBox runat="server" ID="chk"  />
      </ItemTemplate>
 </telerik:RadComboBox>


C# code

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
  {
PopulatePopulation();
  }
}

 private void PopulatePopulation()
    {
        ddlPopulation.DataSource = Job.GetPopulations();
        ddlPopulation.DataTextField = "PopulationName";
        ddlPopulation.DataValueField = "PopulationID";
        ddlPopulation.DataBind();
    }

 protected void ddlPopulation_ItemDataBound(object sender, Telerik.Web.UI.RadComboBoxItemEventArgs e)
    {
        CheckBox chk = e.Item.FindControl("chk") as CheckBox;
        chk.Text = e.Item.Text;
    }

 protected void ddlPopulation_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
//TODO: do some work
    }

Please help me how can I get server side event. On this Event I need to populate one another ComboBox.

Thanks
Paresh


Paresh Dehadray
Top achievements
Rank 1
 answered on 20 Aug 2011
2 answers
269 views
I have a column in a grid that is a certain width but the text in the column could be longer than the specified width.  If that happens I wanted to cut off the overflowing text (instead of wrapping) and replace it with an ellipsis.  The only way I could get this to work with CSS was to add the following styles to my page:

<style type="text/css">
div.RadGrid_Vista .rgRow td div,
div.RadGrid_Vista .rgAltRow td div
{
    white-space         : nowrap !important;
    overflow            : hidden !important;
    text-overflow       : ellipsis !important;
}
</style>

Next, I set the width to 150px in the ItemStyle for my column.  This didn't work, so after a lot of trial and error, I realized that those styles would only work on a DIV...not the TD tag that was being created in from the grid control.  To fix this, I added the following DataFormatString value to the GridBoundColumn:   DataFormatString="<div style='width:150px'>{0}</div>"

I had to add the width or else it didn't wrap and ignored the overflow and text-overflow settings.

Ok, so I got all of that to work, but now the last problem I'm having is when I click on the Edit button (EditForms mode), the selected row then expands in height and ignores the styles I added.

I've attached two images.  One that shows what I it looks in view mode, and the other showing what it looks like in edit mode.  I want both to look like the one in view mode (truncated with ellipsis).

Thanks,
Aaron
Aaron
Top achievements
Rank 1
 answered on 20 Aug 2011
6 answers
322 views
Hi, I use the example from RadRibbonBar, and the images are not displaying at all. What do I miss here? How can I find those icons using Skin="Office2007"

 

 

<telerik:RibbonBarTab Text="Home">

 <telerik:RibbonBarGroup Text="Clipboard" EnableLauncher="true">

 <Items>

 <telerik:RibbonBarMenu Size="Large" Text="Paste" ImageUrl="icons/home/Paste.png">

 <Items>

 <telerik:RibbonBarMenuItem Text="Paste" ImageUrl="icons/home/Paste.png" />

 

<telerik:RibbonBarMenuItem Text="Paste Special..." ImageUrl="icons/home/Paste.png" />

 </Items>

</telerik:RibbonBarMenu> <telerik:RibbonBarButton Size="Medium" Text="Cut" ImageUrl="icons/home/Cut.png" /> <telerik:RibbonBarButton Size="Medium" Text="Copy" ImageUrl="icons/home/Copy.png" />

 <telerik:RibbonBarButton Size="Medium" Text="Format" ImageUrl="icons/home/Format_Painter.png" />

 </Items>

 </telerik:RibbonBarGroup>

1)Here is part of the code. I don't know where those images are located?

2) Is there any default image in this control? I just want to see if I can use this control and have a quick way to access those image.

Jesper
Top achievements
Rank 1
 answered on 20 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?