Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
208 views
Hi,
How to clear items in drop down of radcombobox?

 

RadComboBox.DataSource = dvBrowse.Table;

RadComboBox.DataBind();

protected void RadComboBox_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
        {
           
            e.Item.Value = ((DataRowView)e.Item.DataItem)[0].ToString();
            e.Item.Text = ((DataRowView)e.Item.DataItem)[1].ToString();
        } 

this doesnt clear the old items in drop down.

Shinu
Top achievements
Rank 2
 answered on 21 Aug 2009
0 answers
123 views
I used version Q2-2009, and I'm trying to mimic yahoo mail site
but I have some problems with that UseStaticHeaders
when I debug my site with IE 7, in normal browser size, I have this, pretty good.
http://i20.photobucket.com/albums/b222/grandholy/mail1.png
when I maximize the browser size, I have this, not bad
http://i20.photobucket.com/albums/b222/grandholy/mail2.png
but when I turn browser size to normal again, oops, there's something wrong
http://i20.photobucket.com/albums/b222/grandholy/mail1.png
and I have 3 question
1- how to fix this problem?
2- I want my radgrid auto resize like yahoo mail, as you see, there's still a Horizontal scrollbar in it
3- If I try to click the link button in my radgrid and I'm using ajax, the first time it's looked like the page reloading, but the second click is fine, I wonder why?
oh, and one more thing, when I click in the link button first time, it's ok, but if I click the second time without scrolling, the radgrid's record position come back to 1st record , I wonder why?
this is my entire code
http://www.mediafire.com/?zm2zfknj4wu
and the problem in the Mails.ascx file =.=
please reply asap, thank you.
Nguyễn Đại Dương
Top achievements
Rank 1
 asked on 21 Aug 2009
1 answer
97 views
   protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
    {  
        if (e.CommandName == RadGrid.InitInsertCommandName)  
        {  
            GetData(RadGrid1, "SELECT [RoleID],[Rolename] FROM [vw_UsersinRoles] WHERE [UserID] = " + this.DropDownList4.SelectedValue + " ORDER BY [Username]");  
        }  
        else if (e.CommandName == RadGrid.UpdateCommandName)  
        {  
        }  
        else if (e.CommandName == RadGrid.DeleteCommandName)  
        {  
            SQLQuery("DELETE FROM [UsersinRoles] WHERE [UserID] = " + this.DropDownList4.SelectedValue + " AND [RoleID] = " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["RoleID"].ToString());  
        }  
        else if (e.CommandName == RadGrid.EditCommandName)  
        {  
        }  
        else if (e.CommandName == RadGrid.PerformInsertCommandName)  
        {  
            GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item.OwnerTableView.GetInsertItem();  
            string RoleIDstring = (insertedItem["RadComboBox2"].Controls[0] as RadComboBox).SelectedValue;  
            int RoleID = Convert.ToInt16(RoleIDstring);  
            SQLQuery("INSERT INTO [UsersinRoles] ([UserID],[RoleID]) VALUES (" + this.DropDownList4.SelectedValue + "," + RoleID + ")");  
        }  
    }  
 public static void GetData(RadGrid RadGrids, String SqlQuery)  
    {  
        DataTable dtTable = new DataTable();  
        string conn = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ToString();  
        SqlDataAdapter sqladp = new SqlDataAdapter();  
        SqlConnection sqlconn = new SqlConnection(conn);  
        sqlconn.Open();  
        try 
        {  
            string selectQuery = SqlQuery;  
            sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn);  
            sqladp.Fill(dtTable);  
            RadGrids.DataSource = dtTable;  
            RadGrids.DataBind();  
        }  
        finally 
        {  
            sqlconn.Close();  
        }  
    }  
 
    public static void SQLQuery(String SqlQuery)  
    {  
        string conn = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ToString();  
        SqlConnection sqlconn = new SqlConnection(conn);  
        sqlconn.Open();  
        try 
        {  
            SqlCommand cmd = new SqlCommand(SqlQuery, sqlconn);  
            cmd.ExecuteNonQuery();  
        }  
        finally 
        {  
            sqlconn.Close();  
        }  
    } 
  <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" 
        AllowAutomaticDeletes="True" AllowPaging="True" EnableLinqExpressions="False" 
        OnItemCommand="RadGrid1_ItemCommand" AutoGenerateColumns="False" Width="310px" 
        BorderColor="Black" BorderWidth="1px" GridLines="None">  
        <HeaderContextMenu EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </HeaderContextMenu> 
        <MasterTableView DataKeyNames="RoleID" CommandItemSettings-AddNewRecordText="Add New Role" 
            CommandItemDisplay="Top">  
            <CommandItemSettings AddNewRecordText="Add New Role"></CommandItemSettings> 
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridTemplateColumn UniqueName="DeleteColumn" ItemStyle-Width="16px" AllowFiltering="false">  
                    <HeaderStyle Width="16px" /> 
                    <ItemTemplate> 
                        <asp:ImageButton ID="imgbtnDelete" Width="14px" ToolTip="Delete Contact" runat="server" 
                            CommandName="Delete" ImageUrl="~/images/recycle.jpg" OnClientClick="javascript:if(!confirm('This action will delete the selected contact. Are you sure?')){return false;}" /> 
                    </ItemTemplate> 
                    <ItemStyle Width="16px"></ItemStyle> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn HeaderText="Rolename" UniqueName="RolenameColumn">  
                    <EditItemTemplate> 
                        <telerik:RadComboBox ID="RadComboBox2" AppendDataBoundItems="true" Height="200px" 
                            runat="server" Skin="WebBlue" DataTextField="Rolename" DataValueField="RoleID" 
                            DataSourceID="RCBaddnewrole" SelectedValue='<%# Bind("Rolename")%>'>  
                            <Items> 
                                <telerik:RadComboBoxItem Text="" Value="" /> 
                            </Items> 
                        </telerik:RadComboBox> 
                    </EditItemTemplate> 
                    <ItemTemplate> 
                        <%#Eval("Rolename")%> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
            </Columns> 
            <EditFormSettings ColumnNumber="3" CaptionFormatString="Edit details for User {0}" 
                CaptionDataField="RoleID">  
                <EditColumn UniqueName="EditCommandColumn1">  
                </EditColumn> 
                <FormTemplate> 
                    <asp:Table runat="server" ID="Table1" CellSpacing="1" CellPadding="1" Width="250" 
                        border="0">  
                        <asp:TableRow> 
                            <asp:TableCell ID="RCB2">  
                                <telerik:RadComboBox ID="RadComboBox2" runat="server" DataSourceID="RCBaddnewrole" 
                                    DataTextField="Rolename" DataValueField="RoleID">  
                                </telerik:RadComboBox> 
                            </asp:TableCell> 
                        </asp:TableRow> 
                        <asp:TableRow> 
                            <asp:TableCell> 
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>  
                                </asp:Button>&nbsp;  
                                <asp:Button CausesValidation="false" ID="btnEdit" Text="EditRole" runat="server" 
                                    CommandName="EditRole"></asp:Button> 
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" 
                                    CommandName="Cancel"></asp:Button></td>  
                            </asp:TableCell> 
                        </asp:TableRow> 
                    </asp:Table> 
                </FormTemplate> 
            </EditFormSettings> 
            <NoRecordsTemplate> 
                No Records  
            </NoRecordsTemplate> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <asp:SqlDataSource ID="RCBaddnewrole" runat="server" ConnectionString="<%$ ConnectionStrings:LawsonSecurityConnectionString %>" 
        SelectCommand="SELECT [Rolename], [RoleID] FROM [Roles] ORDER BY [Rolename]">  
    </asp:SqlDataSource> 

Trying to access the RadComboBox item within the add new to use the selectedvalue to nisert into the SQL table.

I've hitting my head trying to access it through different ways but have no idea.

Is there a way if you add certain controls to different areas of a radgrid you can do a reverse look up on the item and know it's location within the radgrid? 

Thanks again you guys are awesome.
Jon-Jon Kershaw
Top achievements
Rank 2
 answered on 20 Aug 2009
0 answers
203 views
Hi,

Q2.2009.
I have problems to fire my RadTimePicker and returning the value in the Box. After each selected item over highlighted item (<a>) my page scroll and no time is returned in the box. I have tested many configurations and templates and have this problem every time. I need to select the items between the highlighted item and the small border ( left or right borders). In this case the item fire and return the value but is not possible to work in this case because i need to push between 2 or 3px in borders to fire. Could you suggest some solution please.

regards Romi.

<div class="boxLunVen"> 
                <div class="boton1"><img  alt='' src="../VistaStatic/images/Submenu/configurador1/semana.png" /></div> 
                <div class="time"> 
                <telerik:RadTimePicker ID="RadTimeInLunVen" runat="server" style="vertical-align:middle;" Width="60px" 
                         StartTime="13:0:0" EndTime="22:31:00" Interval="0:30:0" Columns="2" TimeFormat="HH:mm" Culture="es-ES"    
                         DateFormat="HH:mm" OnClientTimeSelected="OnTimeSelectedSem">      
                </telerik:RadTimePicker> 
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="RadTimeInLunVen" ValidationGroup="group1"></asp:RequiredFieldValidator> 
                </div> 
                <div class="clear"></div>  
                
            </div> 
            <div class="boxSamedi"> 
                <div class="boton1"><img  alt='' src="../VistaStatic/images/Submenu/configurador1/weekend.png" /></div> 
                <div class="time"> 
                <telerik:RadTimePicker ID="RadTimeInSamedi" runat="server" style="vertical-align:middle;" Width="60px"> 
                        <ClientEvents OnPopupClosing="OnPopupClosing" /> 
                        <TimeView StartTime="13:0:0" EndTime="22:31:00" Interval="0:30:0" Columns="2" TimeFormat="HH:mm" Culture="en-US" OnClientTimeSelected="OnTimeSelected" runat="server">  
                        </TimeView> 
                        <DateInput DateFormat="HH:mm" Culture="en-US" runat="server"></DateInput>    
                </telerik:RadTimePicker> 
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" ControlToValidate="RadTimeInSamedi" ValidationGroup="group1"></asp:RequiredFieldValidator> 
           
                </div> 
                <div class="clear"></div>  
                 
            </div> 

Regards
Pierre
Top achievements
Rank 1
 asked on 20 Aug 2009
1 answer
432 views
How can I set a rad grid to have all it's hierarchal dataviews shown/expanded all the time? I know you can do one row with the expanded attribute, but it seems looping through them and expanding all doesn't work as expected. IS there a property or place in the page lifecycle where I could put the loop? I basically want all data in the grid shown all the time.

Thanks.
Daniel
Telerik team
 answered on 20 Aug 2009
2 answers
188 views
Hello,
   I have 2 radgrids, each one inside a .ascx control.  Each control is inside a RadPageView on the same .aspx page.  When I delete a record from one radgrid, I need the other one to refresh with the correct information.  (basically parent child relation between the two grids)  How can I update the datasource on the child radgrid?

Thanks

Zed
Top achievements
Rank 1
 answered on 20 Aug 2009
1 answer
99 views
I have one RadMenu and RadWindows that can be opened by a user.  The RadWindows are all the same so this would be like and MDI example.  The RadMenu controls navigation in each of the windows.  The use of the windows is controled by a TabStrip that hide or shows the tabs based off the users selection much like the following example.

http://demos.telerik.com/aspnet-ajax/window/examples/default/defaultcs.aspx

My problem is that when I click on one of the RadMenuItems it always controls the last RadWindow that was opened.  I want the RadMenu to control the RadWindow that is showing and leave the other RadWindows alone.  Do you have any suggestions?
Chris
Top achievements
Rank 1
 answered on 20 Aug 2009
2 answers
138 views
I have  a page that uses RadWindows much like the following demo.

http://demos.telerik.com/aspnet-ajax/window/examples/default/defaultcs.aspx

The RadWindows are always maximized and have no behaviors given.  I have added a RadMenu to the top of the page which should control the RadWindow's contents.  I set the z-index of the RadWindowManager to 3000 and the z-index of the RadMenu to 7000.  The RadMenu still shows behind the RadWindow.  Is there something I am missing or are there any other suggestions.
Chris
Top achievements
Rank 1
 answered on 20 Aug 2009
3 answers
253 views
OK, I am sure this is easier than I am making this out to be, but how do you bind the elements in the Item Template during the  ItemDataBound event? Here is my aspx code:
<telerik:RadPanelBar ID="RadPanelBar1" Width="100%" runat="server"   
    onitemdatabound="RadPanelBar1_ItemDataBound">                  
        <Items> 
            <telerik:RadPanelItem Text="Help" ImageUrl="/Images/question.png" Expanded="True">  
                <ItemTemplate> 
                    <uc1:ctrlQuestion ID="ctrlQuestion" runat="server" />
 
                </ItemTemplate> 
            </telerik:RadPanelItem> 
        </Items> 
</telerik:RadPanelBar> 

I want to access my control, but am not sure how to get at it:

...
RadPanelBar1.DataSource = objCollection;

RadPanelBar1.DataBind();

...

protected void RadPanelBar1_ItemDataBound(object sender, Telerik.Web.UI.RadPanelBarEventArgs e)  
{  
     //?????
     ctrlQuestion.CallSomeMethod();           
} 

I tried e.Item.FindControl("ctrlQuestion"), but it always returns null.

Any help would be greatly appreciated!
Charles Meyer
Top achievements
Rank 1
 answered on 20 Aug 2009
2 answers
136 views
Hi,
I'm trying to use this (hoverIntent) jquery plug in in my code and doesn't seem to work. How can I add a jquery plugin?

I have included the followings to my page.
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" >
    <Scripts>
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
        <asp:ScriptReference Path="~/js/jquery.hoverIntent.minified.js" />
       
    </Scripts>
</telerik:RadScriptManager>

thanks
M Givi
Top achievements
Rank 1
 answered on 20 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?