Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
198 views
I'm having trouble changing the background colors for alternating rows. (Or the regular rows too I guess)

I have tried:

<ItemStyle BackColor="Black" ForeColor="Red" />
<AlternatingItemStyle BackColor="White" />

and

tr.GridAltRow_Default 
 color: Black; 
 background-color: White; 
 background-image: none; 

The ForeColor properties work fine, so I know that some part of it is working, but nothing I do changes the background color. What am I doing wrong?

Edit: We're using the Q3 2008 RadGrid release

Edit 2: Never mind. I figured this out. Another developer had coded some colors directly into the cs file.
Andy
Top achievements
Rank 1
 asked on 30 Jun 2009
3 answers
226 views
Hello,

I have a radcombobox with an ItemTemplate that contains a checkbox and a label.

                                <telerik:RadComboBox ID="cbM0016" runat="server"  
                                    EmptyMessage="Select Branch" HighlightTemplatedItems="true" 
                                    AllowCustomText="true" Enabled="false" Skin="Outlook" Width="100%" > 
                                    <ItemTemplate> 
                                        <asp:CheckBox runat="server" ID="chk1" Checked="true" onclick="onCheckBoxClickM0016(this)"/> 
                                        <asp:Label runat="server" ID="lbl1" Text='<%#DataBinder.Eval(Container.DataItem, "BranchNameAndID")%>'/> 
                                    </ItemTemplate> 
                                </telerik:RadComboBox> 
 


One of the checkboxes (the "ALL" checkbox) will trigger all other checkboxes to be checked and store all the associated values as a comma delimited string.  This is being done in the javascript.  The problem I'm having is that occasionally my values are not being posted back to the server.  

Repro steps are:  
Load the form (default selection works fine)
Unselelct several checkboxes and submit the form (works fine)
Select the "ALL" checkbox (form does not submit the updated values)

I have added alerts in the javascript that show that the values are being set on the client side.  Here is that code...

function onCheckBoxClickM0016(sender) { 
            var combo = $find("<%= cbM0016.ClientID %>"); 
            //holds the text of all checked items 
            var text = ""
            //holds the values of all checked items 
            var values = ""
            //get the collection of all items 
            var items = combo.get_items(); 
 
            //get the ALL checkbox 
            var chk1 = $get(combo.get_id() + "_i0" + "_chk1"); 
            if (chk1.checked && sender.id == "cbM0016_i0_chk1") { 
                text = "ALL"
                //enumerate all items 
                for (var i = 1; i < items.get_count(); i++) { 
                    var item = items.getItem(i); 
                    //get the checkbox element of the current item 
                    var chk2 = $get(combo.get_id() + "_i" + i + "_chk1"); 
                    chk2.checked = true
                    values += item.get_value() + ","
                } 
            } 
            else { 
                var count = 0; 
                //enumerate all items 
                for (var i = 1; i < items.get_count(); i++) { 
                    var item = items.getItem(i); 
                    //get the checkbox element of the current item 
                    var chk2 = $get(combo.get_id() + "_i" + i + "_chk1"); 
                    if (chk2.checked) { 
                        count += 1; 
                        text += item.get_text() + ","
                        values += item.get_value() + ","
                    } 
                } 
                if (count == i - 1 && sender.id != "cbM0016_i0_chk1") { 
                    chk1.checked = true
                } 
                else { 
                    chk1.checked = false
                } 
            } 
 
            //remove the last comma from the string 
            text = removeLastComma(text); 
            values = removeLastComma(values); 
 
            if (text.length > 0) { 
                //set the text of the combobox 
                if (chk1.checked) { 
                    combo.set_text("ALL"); 
                } else { 
                    combo.set_text(text); 
                } 
            } 
            else { 
                //all checkboxes are unchecked 
                //so reset the controls  
                combo.set_text(""); 
            } 
 
            combo.set_value(values); 
        } 


Please help.

-Billy

Billy
Top achievements
Rank 1
 answered on 30 Jun 2009
2 answers
146 views
I have a created a radgrid which takes data from a table and displays it in rows. Each row  has an edit button which when clicked opens details of that row. The user should be able to update this.

The aspx code has the radgrid part:

 <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="EditDataSource" GridLines="None" OnItemCommand="RadGrid1_ItemUpdated">

    <MasterTableView AllowAutomaticUpdates="false" AllowAutomaticInserts="false" autogeneratecolumns="False" datasourceid="EditDataSource">

    <columns>

        

            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">

            </telerik:GridEditCommandColumn>

             <telerik:GridBoundColumn HeaderText="OrganizationName" HeaderButtonType="TextButton" DataField="OrganizationName">

            </telerik:GridBoundColumn>

             <telerik:GridBoundColumn HeaderText="OrganizationName" HeaderButtonType="TextButton" DataField="ContactID">

            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn HeaderText="firstname" HeaderButtonType="TextButton" DataField="FirstName">

            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn HeaderText="lastname" HeaderButtonType="TextButton" DataField="LastName">

            </telerik:GridBoundColumn>

            <telerik:GridBoundColumn HeaderText="Title" HeaderButtonType="TextButton" DataField="Title">

            </telerik:GridBoundColumn>

              </columns>

            <EditFormSettings UserControlName="Contact.ascx" EditFormType="WebUserControl">

                <EditColumn UniqueName="EditCommandColumn1"></EditColumn>

                <PopUpSettings ScrollBars="None"></PopUpSettings>

            </EditFormSettings>

    </MasterTableView>

    </telerik:RadGrid>




the details are displayed using a user control which looks like this:


private object _dataItem = null;
public object DataItem
{
    get
    {
        return this._dataItem;
    }
    set
    {
        this._dataItem = value;
    }
}
  
</script>

<table id="OrgTable">
<tr><td><strong>Contact Details:</strong></td></tr>
<tr>
 <td>Contact ID</td>
    <td><asp:TextBox id="ID" runat="server" Text='<%# DataBinder.Eval( Container, "dataItem.ContactID" ) %>'>
    </asp:textbox></td>
    <td>Prefix</td>
    <td><asp:TextBox id="prefix" runat="server" Text='<%# DataBinder.Eval( Container, "dataItem.prefix" ) %>'>
    </asp:textbox></td>
    <td>First Name</td>
    <td><asp:TextBox id="firstname" runat="server" Text='<%# DataBinder.Eval( Container, "dataItem.FirstName" ) %>'>
    </asp:textbox></td>
    </tr>
    <tr>
     <td>Middle Name</td>
    <td><asp:TextBox id="middlename" runat="server" Text='<%# DataBinder.Eval( Container, "dataItem.MiddleName" ) %>'>
    </asp:Textbox></td>
     <td>Last Name</td>
    <td><asp:TextBox id="lastname" runat="server" Text='<%# DataBinder.Eval( Container, "dataItem.LastName" ) %>'>
    </asp:Textbox></td>
</tr>
<tr>
     <td>Title</td>
    <td><asp:TextBox id="title" runat="server" Text='<%# DataBinder.Eval( Container, "dataItem.Title" ) %>'>
    </asp:Textbox></td>
   
</tr>
<tr>
   <asp:Button CommandName="Update" runat="server" text="Update"  />
   
</tr>
</table>
 


I am not sure how I can update the table on clicking the update button. 


The code behind of the aspx has the following:


protected void RadGrid1_ItemUpdated(object source, GridCommandEventArgs e)
    {
        //Get the GridEditableItem of the RadGrid     
        GridEditableItem editedItem = (GridEditableItem)e.Item;  
        conn = new OleDbConnection(connectionstring);
        conn.Open();
        //Get the primary key value using the DataKeyValue.     
  
        
       // string ContactID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ContactID"].ToString();

        //Access the textbox from the edit form template and store the values in string variables.     
        
       string FirstName = (editedItem.FindControl("FirstName ") as TextBox).Text;
        string Title = (editedItem["Title"].Controls[0] as TextBox).Text;

        
            //Open the SqlConnection     
           
           
            string updateQuery = "something ";
        
         cmd = new OleDbCommand(updateQuery);
            cmd.ExecuteNonQuery();
          Close the SqlConnection     
            conn.Close();


        
    }
 


The variables Firstname and Title don't have the updated values. I dont think the event is triggered when I click on the update button either. Any help would be greatly appreciated.


Thanks,

jlesidt
Top achievements
Rank 1
 answered on 30 Jun 2009
2 answers
128 views
Hi

I have a radgrid that contains tooltips. These tooltips load content on demand. One of the controls inside the tooltip is a third party component which is a map object. The map generates an image which is rendered as a html image. Each tooltip should display a different map.

The first tooltip loads ok but all of the subsequent tooltips show the map from the first tooltip. I thought at first this was a caching issue and that the tooltips were loading the the image file belonging to the first tooltip. However i can see the images being generated in the directory on the hard drive and each tooltip is generating a separate image it's just for some bizarre reason all of the maps are displaying the same data

All of the information to generate the correct map is being passed back in the AjaxUpdate event. You can see this because if for example you look at tooltip1 then the map from tooltip1 is shown in all the other tooltips but if you look at tooltip2 first then map2 is shown in all the tooltips.

I don't know enough about what is happening in the process of loading content on demand to know what might be going wrong with the third party control. Something odd is happening in the AjaxUpdate bit.

any help is greatly appreciated

thanks in advance
andieje
Top achievements
Rank 1
 answered on 30 Jun 2009
0 answers
127 views
I replaced an asp.net GridView with an AJAX RadComboBox. Loading the page takes 3 times more than grid view version using same methods to populate controls. I'm also using RadCompression and I can see it's working according to Firebug. Is there any setting I'm missing in order to speed up the page? Thanks.
Jp Maxwell
Top achievements
Rank 1
 asked on 30 Jun 2009
2 answers
168 views
Is there a way to Client side filter a grid on multiple columns? As an example, say I have two columns; Title & Description. If I have a textbox where someone can enter a filter term I want to be able to use that serch term on both columns in an OR fashion to accomplish the following

search where title OR description contains search_term 

I see that the GridTableView has a filter function but it appears to only filter a single column.
BaiH
Top achievements
Rank 1
 answered on 30 Jun 2009
1 answer
93 views
I have a TreeView that can add nodes dynamically in the client.  After you edit the name of the newly added node it uses ajax to go back to the server to update the database with the new node.

When I run this ASCX on it's own page it runs fine.  However, when I embed this ASCX as content within a tab pane the NodeEdit event stops firing after you edit a newly added node.  It still runs, though, when editing an already-existing node.

Any initial thoughts?  I'm not sure how to pull this out and do a simple repro.  My guess is it won't repro when I dumb down the code.

Thanks,
Kevin
Kevin Warnke
Top achievements
Rank 1
 answered on 30 Jun 2009
3 answers
128 views
Hi,
I'm trying to add a custom filter to grid using js, like this:
tableView.get_filterExpressions().clear();
tableView.get_filterExpressions().add("ContributionID='" + $get('cContributionID').value + "'");

And this works great. However; if we then filter using the gridcolumn it breaks on:
Telerik.Web.UI.GridFilterExpressions.prototype={find:function(_3e8){
for(var i=0,_3ea=this.get_count();i<_3ea;i++){
var item=this.getItem(i);
if(item.get_columnUniqueName()==_3e8){
return item;
}

Because item is just the filterstring.
I've read http://www.telerik.com/help/aspnet-ajax/grid_filter.html , but that requires that the filtered field is in the grid.

Please advice.
Tsvetoslav
Telerik team
 answered on 30 Jun 2009
3 answers
95 views
The message is Sys.ArgumentOutOfRangeException: Value must be an integer
Parameter name: x
Actual value was NaN

the page has the splitter, when I click to make it slide out, I get this error.
Please help, thanks.
Martin
Top achievements
Rank 1
 answered on 30 Jun 2009
3 answers
138 views
Hi,

I'm creating a grid dynammically on Page_Init event and using a placeholder declared in my html code. When the page load first time, the grid, the columns, the datasource are created perfectally. When I do a new ajax request (like perfoming a filter), the grid is created like expected on Page_Init (defining all structure like described in telerik online demos), but when the DetailTableDataBind event is called the grid comes with its structure changed. Example, first time the page inits I create a grid with the following structure (on Page_init event):

- MasterTableView
---- DetailtTable 1
-------- DetailTable 1.1
-------- DetailTable 1.2
-------- DetailTable 1.3

After performing a filter (the second load), the grid must be created like this:

- MasterTableView
---- DetailtTable 1
-------- DetailTable 1.1

I follow the code in debug and it is created ok. But when the code enter in DetailTableDataBind event, the grid changed its structure and back to the first structure:

- MasterTableView
---- DetailtTable 1
-------- DetailTable 1.1
-------- DetailTable 1.2
-------- DetailTable 1.3

The instance of the grid is the same (before and after the the DetailTableDataBind event). In don't know why it is ignoring my modifications on the grid structure at Page_Init event. Another problem is when calling the DetailTableDataBind event the Name property is empty even when I set its value (after the first page request).

Thanks.



Pavlina
Telerik team
 answered on 30 Jun 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?