Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
198 views
I have two radgrid controls in a window. Both of the grids initially utilize the same data and both are bound to the underlying data.
In grid1 the last column is a checkbox to which I have attached a click event. What I need to do, because of the way the underlying data will be used, when the checkbox in grid1 is clicked, the corresponding row checkbox in grid2 becomes checked, and I need this to be client-side.

What I have done is use javascript to get the checkbox id, change the reference from grid1 to grid2 and update the related checkbox in grid2 to the checked state of the item in grid1. This works as expected for only the first item in grid1. After some digging, I have found that the checkboxes in grid2 are not numbered in the same fashion as those in grid1, despite having the same columns, data and controls.

For example, the checkbox ID in row0 is grid1_ctl00_ctl04_cbxConfirm. The checkbox in the second grid is grid2_ctl00_ctl04_cbxConfirm. When I look at row1, the source ID is grid1_ctl00_ctl05_cbxConfirm, but the destination is grid2_ctl00_ctl06_cbxConfirm. It seems that checkboxes in grid1 are incremented by 1 for each row, while in grid2, the checkbox ID is being incremented by 2 for each row.

I am not creating any other controls (both grids are identical)

Is there a better way to handle this update?
Is there something I need to look at regarding the control incrementing?

Thanks
Keith
Top achievements
Rank 2
 answered on 02 Jul 2012
0 answers
97 views
Hello.

My grid bound column contains html markup like <table><tr><td>MyText</td></tr></table>
If i right click on this cell i see browser context menu.  Can i do that i see context menu?

Best Regards,
Alexandr.
Петряков
Top achievements
Rank 1
 asked on 02 Jul 2012
2 answers
414 views

The text in my radgrid is bleeding into the next field. I have tried fixing the issue using CSS, but, I'm not getting the desired results. Here is my code.
<script type="text/css">
.RadGrid .rgHeader, 

.RadGrid .rgEditRow td,

.RadGrid .rgRow td,

.RadGrid .rgAltRow td

{

white-space : nowrap !important;

overflow : hidden !important;

text-overflow : ellipsis !important;

table-layout : fixed !important;

}

</script>

 

<telerik:RadScriptManager ID="ScriptManagerAggressiveMatches" runat="server" EnableTheming="True">

 </telerik:RadScriptManager>

 

<telerik:RadGrid ID="RadGridAggressiveMatches" runat="server" DataMember="Aggressive Members" AutoGenerateEditColumn="True" GridLines="None" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" ShowFooter="True" Skin="Office2007" PageSize="50">

<ItemStyle Width="20px" />

<PagerStyle Mode="NumericPages" NextPageText="Next" PrevPageText="Previous" />

<MasterTableView Width="98%" TableLayout="Fixed">

<
RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>  

</RowIndicatorColumn

<
ExpandCollapseColumn>

 <HeaderStyle Width="20px"></HeaderStyle>

 </ExpandCollapseColumn>

 

 </MasterTableView
 

<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">

<Selecting AllowRowSelect="True" />  

<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings
 

<FilterMenu EnableTheming="True">  

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>  

</FilterMenu>

</telerik:RadGrid>

 



Jayesh Goyani
Top achievements
Rank 2
 answered on 02 Jul 2012
1 answer
121 views
I would like to get the value of the DataValueField on Item Click and use that value for the Items Expanded. Something like below.
Protected Sub RadPanelBar1_ItemClick(sender As Object, e As Telerik.Web.UI.RadPanelBarEventArgs) Handles RadPanelBar1.ItemClick
 
    Dim Extend = RadPanelBar1.DataValueField
 
    RadPanelBar1.Items(Extend).Expanded = True
 
End Sub


Is this possible?
Kate
Telerik team
 answered on 02 Jul 2012
1 answer
673 views
Hi,

I need to check if a GridButtonColumn was clicked client-side and I also need to know for which row this was.
Getting the event was easy, I subscribed to the OnCommand client event and check if it is my button:

function OnCommand(sender, args) {
   if (args.get_commandName() == "MyCommand") {
      args.set_cancel(true);
      // need to get the current row
   }
}

But how can I access the row in which the button was clicked?

Thanks!

Edit: I just saw how to acccess the row index:
var rowIndex = args.get_commandArgument();

But how can I access the dataKeyValue of this row?
Shinu
Top achievements
Rank 2
 answered on 02 Jul 2012
1 answer
80 views
hi
i have created a recurrence event say on 6/29/2012 that is weekly so it will also occur on next week 7/6/2012 .But in database i have only one entry with a single ID. So how can i differentiate between both appointment in the terms of any unique id or whatever being is possible.
Plamen
Telerik team
 answered on 02 Jul 2012
5 answers
295 views
Hi,

I can't force following code to work, meaning the values of the decimals are multiplied by 100 and no combination of DecimalSeparator nor DecimalDigits nor Culture setting renders 5.19m as 5,19 (or 5.19 for that matter) - the result is always 519

<%@ Page Language="C#" AutoEventWireup="true"  %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager runat="server" ID="ScriptManager1">
    </asp:ScriptManager>
    <script type="text/C#" runat="server">
     
        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            System.Data.DataTable table = new System.Data.DataTable();
            table.Columns.Add("ID", typeof(int)); 
                       
            table.Columns.Add("pct", typeof(decimal));
            table.Rows.Add(1, 5.19m);
            table.Rows.Add(2, 99.49m);
            table.Rows.Add(3, 19.69m);
            table.Rows.Add(4, 5.99m);
  
            RadGrid1.DataSource = table;
        }
      
    </script>
      <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource">
        <MasterTableView>
            <Columns>
                <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" UniqueName="ID">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="perComplete" HeaderText="Percent Complete"
                    AllowFiltering="false">
                    <ItemTemplate>
                        <telerik:RadNumericTextBox ID="pct"  runat="server" Text='<%#Eval("pct") %>'  Width="70px">
                            <NumberFormat AllowRounding="false" />                           
                        </telerik:RadNumericTextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    </div>
    </form>
</body>
</html>
Vasil
Telerik team
 answered on 02 Jul 2012
2 answers
551 views
I watched the following demo (  RadGrid for ASP.NET AJAX - Declarative Client-Side Binding, Pt. 1 )

What I am trying to figure out is the best approach for a loading spinner icon... I found an example: (  Grid / Programmatic Binding   )
But I can't get the Loading panel to show on mine. 

I build the exact same demo (northwind) in the Demo  RadGrid for ASP.NET AJAX - Declarative Client-Side Binding, Pt. 1,   I just not sure how to get the loading Spinner to show up via client side code....


Daniel
Telerik team
 answered on 02 Jul 2012
1 answer
135 views
I am having my design with radtabstrip and RadMultiPage as follows
<telerik:RadTabStrip ID="rdtabEmployee" runat="server" MultiPageID="rdmpPersonal"
            UnSelectChildren="True" Skin="WebBlue" EnableEmbeddedSkins="False" ClickSelectedTab="True"
            SelectedIndex="0" OnTabClick="tabClick">
            <Tabs>
                <telerik:RadTab runat="server" Text="Personal" PageViewID="rdpgPersonal">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="Contact" PageViewID="rdpgContact">
                </telerik:RadTab>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="rdmpPersonal" runat="server">
            <telerik:RadPageView ID="rdpgPersonal" runat="server" Selected="true">
                <telerik:RadPanelBar runat="server" ID="rdpnlPersonal" ExpandMode="FullExpandedItem"
                    Skin="Vista" EnableEmbeddedSkins="false" Width="880px">
                    <Items>
                        <telerik:RadPanelItem Expanded="true" Text="Employee Personal Information" runat="server"
                            Selected="true">
                            <Items>
                                <telerik:RadPanelItem Value="AccountInformation" runat="server">
                                    <ItemTemplate>
                                        <label>
                                            Demop
                                        </label>
                                        <telerik:RadDatePicker ID="RadDatePicker1" Width="200px" runat="server" MinDate="1900-01-01"
                                            TabIndex="5">
                                            <Calendar ID="Calendar1" RangeMinDate="1900-01-01" runat="server">
                                            </Calendar>
                                        </telerik:RadDatePicker>
                                        <telerik:RadDatePicker ID="radDtHiredate" Width="200px" runat="server" MinDate="1900-01-01"
                                            TabIndex="5">
                                            <Calendar ID="calHire" RangeMinDate="1900-01-01" runat="server">
                                            </Calendar>
                                        </telerik:RadDatePicker>
                                        <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="validatehiredate"
                                            SetFocusOnError="true" ControlToValidate="RadDatePicker1" ValidationGroup="accountValidation"
                                          ForeColor="Red"  Display="Dynamic">Can not Hire Guy less than 18 yrs</asp:CustomValidator>
                                        <br />
                                        <button onclick="javascript: NextDay(event); return false">
                                            Move to next day</button>
                                        <telerik:RadButton ID="rdbtnpersonalSaveNext" ValidationGroup="accountValidation"
                                            OnClick="rdbtnpersonalSaveNext_Click" TabIndex="11" runat="server" Text="Save & Next">
                                        </telerik:RadButton>
                                    </ItemTemplate>
                                </telerik:RadPanelItem>
                            </Items>
                        </telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelBar>
            </telerik:RadPageView>
            <telerik:RadPageView ID="rdpgContact" runat="server">
                <telerik:RadPanelBar runat="server" ID="RadPanelBar1" ExpandMode="FullExpandedItem"
                    Skin="Vista" EnableEmbeddedSkins="false" Width="880px">
                    <ItemTemplate>
                        <asp:TextBox ID="txtDemo" runat="server">
                        </asp:TextBox>
                    </ItemTemplate>
                </telerik:RadPanelBar>
                <label>
                    Demo Contact
                </label>
            </telerik:RadPageView>
</telerik:RadMultiPage>

When I click on second Tab and came back to first tab the custom validation which i had written fails, can some one help me..

<telerik:RadCodeBlock runat="server" ID="radcb">
            <script type="text/javascript" language="javascript">
                function monthDiff(d1, d2) {
                    var months;
                    var date1 = new Date(d1);
                    var date2 = new Date(d2);
                    return (date1 - date2) / (1000 * 60 * 60 * 24);
                    return months;
                }
 
                //function getLeapYear
 
                function difference(d1, d2) {
                    var diff = 18 * 12;
                    var Age = monthDiff(d1, d2);
 
                    var compareVal = 365 * 18; //getCompareVal(hiredate,dob);
 
                    if (Age >= compareVal) {
                        return true;
                        //true
                    } else {
                        return false; //false
                    }
                }
                function validatehiredate(value, arg) {
                    var datePicker = $find('<%= rdpnlPersonal.FindItemByValue("AccountInformation").FindControl("radDtHiredate").ClientID %>');
                    var datePicker1 = $find('<%= rdpnlPersonal.FindItemByValue("AccountInformation").FindControl("RadDatePicker1").ClientID %>');
 
                    var date = datePicker.get_selectedDate();
                    var date1 = datePicker1.get_selectedDate();
                    arg.IsValid = (difference(date, date1));
                }
            </script>
        </telerik:RadCodeBlock>
Dimitar Terziev
Telerik team
 answered on 02 Jul 2012
5 answers
310 views
Hello,

I'm having trouble using the Asp.net validators with Telerik RadAjaxManager. The messages are "duplicated" after ajax requests.

I have an example to explain.
<telerik:RadScriptManager ID="telerik_ajax_manager" runat="server"/>
 
<telerik:RadAjaxLoadingPanel ID="ajax_loading_panel" Enabled="true" runat="server" MinDisplayTime="1000"         BackColor="#cccccc" Transparency="50"></telerik:RadAjaxLoadingPanel>
 
<asp:ValidationSummary ID="validator_summary" runat="server" />
 
<div id="div_test_1" runat="server" style="border-style:solid;border-color:Black;padding:20px;">
    Test 1:
    <asp:TextBox ID="txt_test_1" runat="server" OnTextChanged="txt_test_1_TextChanged" AutoPostBack="true"></asp:TextBox>
    <asp:Literal ID="ltl_test_1" runat="server"></asp:Literal>
    <asp:RequiredFieldValidator ID="rfv_test_1" runat="server" ControlToValidate="txt_test_1" Display="None"            ErrorMessage="RequiredFieldValidator Test 1"></asp:RequiredFieldValidator>
</div>
<br />
<div id="div_test_2" runat="server" style="border-style:solid;border-color:Black;padding:20px;">
    Test 2:
    <asp:TextBox ID="txt_test_2" runat="server" OnTextChanged="txt_test_2_TextChanged" AutoPostBack="true"></asp:TextBox>
    <asp:Literal ID="ltl_test_2" runat="server"></asp:Literal>
    <asp:RequiredFieldValidator ID="rfv_test_2" runat="server" ControlToValidate="txt_test_2" Display="None"            ErrorMessage="RequiredFieldValidator Test 2"></asp:RequiredFieldValidator>
</div>
<br />
<br />
<asp:Button ID="btn_submit" runat="server" OnClick="btn_submit_Click" Text="Submit" />
 
<telerik:RadAjaxManager ID="ajax_manager" runat="server" DefaultLoadingPanelID="ajax_loading_panel">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="txt_test_1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="div_test_1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="txt_test_2">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="div_test_2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

protected void Page_Load(object sender, EventArgs e)
{}
 
protected void btn_submit_Click(object sender, EventArgs e)
{}
 
protected void txt_test_1_TextChanged(object sender, EventArgs e)
{
    ltl_test_1.Text = txt_test_1.Text;
    txt_test_1.Text = null;
}
 
protected void txt_test_2_TextChanged(object sender, EventArgs e)
{
    ltl_test_2.Text = txt_test_2.Text;
    txt_test_2.Text = null;
}


The page has two updateable areas, each area has a textbox and a Asp.net validator, and each textbox triggers an ajax request updating your area.
If you type something in Test 1, its area will be updated, so if you click the submit button, the summary will show twice the message of the field Test 2 (which has not been updated). Each ajax generates another message.

I verified that this only occurs when the validator is inside an updateable area that is not being updated at this time. Also checked that when you are updating an area, the request create (then duplicating) all the validators that are located in other areas, when the validator is not in an updateable area, it is not created in ajax request.

What could I do?
Andrey
Telerik team
 answered on 02 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
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
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?