Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
406 views
hi,

I am using telerik radgrid in my application  hierarchical model. in detailtables i have one  GridTableView. in the GridTableView i have a GridTemplateColumn in which i have two radio buttons and one textbox. when user enters a value in the textbox and click radio button it should fill all the other textboxes  of the row edited or inserted based on some calculation.

The design as follows.
Please advice me how to work ?
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" Skin="Black" OnItemDataBound="RadGrid1_ItemDataBound" OnItemCreated="RadGrid1_ItemCreated"
    AllowSorting="True" AllowMultiRowSelection="False" OnItemCommand="RadGrid1_ItemCommand" AutoGenerateEditColumn="false"
    OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource" OnInsertCommand="RadGrid1_InsertCommand"
    OnPreRender="RadGrid1_PreRender" >
 
    <MasterTableView DataKeyNames="TempAccountsId" ShowFooter="true" TableLayout="Fixed" AllowMultiColumnSorting="True"  EditMode="InPlace" >
        <DetailTables>
            <telerik:GridTableView DataKeyNames="CleaningId" CommandItemDisplay="Top"  TableLayout="Fixed" Name="Cleaning" ShowFooter="true" EditMode="InPlace" AllowAutomaticUpdates="false">
                <Columns>
                    <telerik:GridTemplateColumn Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblCleaningId" runat="server" Text='<%#Eval("CleaningId") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit" UniqueName="Edit" ItemStyle-Width="25px" HeaderStyle-HorizontalAlign="Center"
                        EditImageUrl="../Images/edit.gif" ItemStyle-HorizontalAlign="Center">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridTemplateColumn HeaderText="Delete" UniqueName="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:ImageButton runat="server" ID="imgdelete" OnClientClick="return confirm('Are you sure that you want to Delete?');"
                                ImageUrl="../Images/delete.gif" CommandName="Delete" CommandArgument="" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                 
                     
 
                    <telerik:GridTemplateColumn HeaderStyle-Width="180" UniqueName="Rate" HeaderText="Rate" ItemStyle-HorizontalAlign="Left"
                            HeaderStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                                <asp:RadioButton ID="rdbtnPerSqft" runat="server" Text="PerSqft" GroupName="Rate" Enabled="false" Checked='<%# bool.Parse(Eval("IsPerSqftRate").ToString()) %>' />
                                <asp:RadioButton ID="rdbtnFlat" runat="server" Text="Flat" GroupName="Rate" Enabled="false" Checked='<%# bool.Parse(Eval("IsFlatRate").ToString()) %>' />
                            </ItemTemplate>
                        <EditItemTemplate>
                             <asp:RadioButton ID="rdbtnPerSqftEdit" runat="server" Text="PerSqft" GroupName="Rate" Checked='<%# bool.Parse(Eval("IsPerSqftRate").ToString()) %>'   />
                                <asp:RadioButton ID="rdbtnFlatEdit" runat="server"  CommandName="Flatrate" Text="Flat" GroupName="Rate" Checked='<%# bool.Parse(Eval("IsFlatRate").ToString()) %>' />
                                <asp:TextBox ID="txtRateEdit" runat="server"  Width="55" CssClass="AlgRgh" Visible="true"  Text='<%# string.Format("{0:n}", Convert.ToDecimal(Eval("PerSqFtRate"))) %>'
                                    onkeypress="javascript:return Allownumbersonly(event);" BorderWidth="1px" ></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:RadioButton ID="rdbtnPerSqftinsert"  runat="server" Text="PerSqft" GroupName="Rate"    />
                                <asp:RadioButton ID="rdbtnFlatinsert" runat="server" Text="Flat" GroupName="Rate"   />
                                <asp:TextBox ID="txtRateinsert" runat="server"  Width="55"  CssClass="AlgRgh"
                                    onkeypress="javascript:return Allownumbersonly(event);" BorderWidth="1px" ></asp:TextBox>
                        </InsertItemTemplate>
                        </telerik:GridTemplateColumn>
 
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridTemplateColumn HeaderText="AccountId" UniqueName="TempAccountsId" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblTempAccountsId" runat="server" Text='<%#Eval("TempAccountsId") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Account Number" UniqueName="AccountNumber" ItemStyle-Width="120px" HeaderStyle-Width="120px" HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                <ItemTemplate>
                    <asp:Label ID="lblAccountNumber" runat="server" Text='<%#Eval("AccountNumber") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Account Name" UniqueName="AccountName" ItemStyle-Width="140px" HeaderStyle-Width="140px" HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                <ItemTemplate>
                    <asp:Label ID="lblAccountName" runat="server" Text='<%#Eval("AccountName") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="lbltotalFooter" runat="server" Text="Total:"></asp:Label>
                </FooterTemplate>
            </telerik:GridTemplateColumn>
             
        </Columns>
    </MasterTableView>
    <ClientSettings AllowKeyboardNavigation="true" EnableRowHoverStyle="true">
        
    </ClientSettings>
</telerik:RadGrid>
courtney shoell
Top achievements
Rank 1
 answered on 15 Oct 2013
2 answers
524 views

Hi,

I have a checkbox set up as such:

<

 

 

telerik:GridCheckBoxColumn DataField="HaulSampledTrueFalse" HeaderText="Haul Sampled?" Visible="false" UniqueName="HaulSampledTrueFalse" EditFormColumnIndex="1"></telerik:GridCheckBoxColumn>

Could someone please advise how to set the state of the checkbox to "ticked" if the data field that the checkbox is bound to, is True.

Thanks, Ida

 

Ida
Top achievements
Rank 1
 answered on 15 Oct 2013
2 answers
130 views
Hi , 
Im using Telerik 2011 Q3 . How can i setting title text format ( color , police ... )  in a radImageTile ? i don't find property ...

Thank's .  
SOFIENE
Top achievements
Rank 1
 answered on 15 Oct 2013
1 answer
89 views
Hi,
I have an unusual question regarding listview. I have used many controls like drop down , gridview etc but didn't find anything like to rebind the control whenever its selectedindexchanged event is fired?

But today when i was working with the Listview of which i was firing its SelectedIndexChanged event on item selection, what i noticed that the event runs successfully for the first time and details of the item selected is shown but as soon as some other item is selected, the event throws an error on the code where it accepts the item value - as shown below

ArgumentOutOfRangeException :
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Exception is thrown when : 

ItemID = ItemListView.SelectedValue.ToString();


 I Though of rebinding it in the event itself and the problem went away.
I am still confused that why i should rebind listview in the SelectedIndexChanged event.

Thanks for reading and any usefull info will be appreciated ..!!
Kostadin
Telerik team
 answered on 15 Oct 2013
1 answer
110 views
Hi,
Iam using Radgrid for ASP.NET project.
In my grid i have 3 textbox column
for Qty,Price and Total Amont as textbox.
Using clientscript i do calculate on Qty*Price textbox value and update the result in Total Amount text box.

upto this its works fine.
but when i click some button ,using Pagin or during postback the new changed value is not displaying.

My code:
in Item data Bound:
 txtQty.Attributes.Add("onFocusout", "return calculate('" + txtQty.ClientID + "','" + txtamnt.ClientID + "','" + txttotamnt.ClientID + "'," + index + ")");
            txtamnt.Attributes.Add("onFocusout", "return calculate('" + txtQty.ClientID + "','" + txtamnt.ClientID + "','" + txttotamnt.ClientID + "'," + index + ")");
            txttotamnt.Attributes.Add("onfocus", "return calculate('" + txtQty.ClientID + "','" + txtamnt.ClientID + "','" + txttotamnt.ClientID + "'," + index + ")");


and my javascript.
 function calculate(cntl1, cntl2, cntl3,rowindex)
           {
                var text1 =$find(cntl1);
                var text2 =$find(cntl2);
                var text3 = $find(cntl3);
               // alert(rowindex);
                var total = text1.get_value() * text2.get_value();
                text3.set_value(total);
                radGrid.MasterTableView.get_dataItems()[rowindex].get_cell("displayAmnt").innerHTML = total;
            }

how to achive textbox Value change value using client side and presist the value.
Angel Petrov
Telerik team
 answered on 15 Oct 2013
3 answers
534 views
Hi,
I'm trying to set ColumnEditorID to GridNumericColumnEditor in radgrid (pop up edit mode).
So:
 <telerik:GridBoundColumn DataField="TRNO_ID" DataType="System.Decimal" HeaderText="ID"
 ColumnEditorID="TRNO_ID_CE">   
</telerik:GridBoundColumn>  


 <telerik:GridNumericColumnEditor ID="TRNO_ID_CE" NumericTextBox-EnabledStyle-HorizontalAlign="Right" 
                                    runat="server" NumericTextBox-Width="75px"
                                    <NumericTextBox ID="NumericTextBox1" runat="server"
                                        <NumberFormat DecimalDigits="2" /> 
                                    </NumericTextBox> 
</telerik:GridNumericColumnEditor> 
But in edit mode this field is displaying like normal textbox.
But when I set:
<telerik:GridTextBoxColumnEditor ID="TRNO_ID_CE" runat="server"
                                    <TextBoxStyle BackColor="#edffc3" BorderColor="#ecbb0d" BorderStyle="Solid" ForeColor="#7fa822" /> 
</telerik:GridTextBoxColumnEditor> 
in edit mode this field has changed background (it's work).
Where is a problem?
Radoslav
Telerik team
 answered on 15 Oct 2013
1 answer
137 views
I have taken many radComboBoxes with treeViews inside of them and converted them to the RadDropDownTree.  On all the previous ones the onEntryAdded has triggered but on only one of them it is not why could this be?  Here is the one that is broken.

<telerik:RadDropDownTree
    ID="personalCriteriaDropDownTree"
    runat="server"
    AutoPostBack="True"
    DefaultMessage="Enterprise"
    DataFieldID="ID"
    DataFieldParentID="ParentID"
    DataTextField="Name"
    DataValueField="TYPE"
    DropDownSettings-AutoWidth="Disabled"
    DropDownSettings-Height="400px"
    ExpandNodeOnSingleClick="True"
    FullPathDelimiter=" > "
    OnClientEntryAdding="onProgramDropDownClientEntryAdding"
    OnClientEntryAdded="persNodeClicking"
    OnClientEntryRemoved="onProgramDropDownClientEntryRemoved"
    OnClientDropDownClosed="persNodeClosing"
    OnEntryAdded ="ProgramDropDownTree_EntryAdded"
    OnNodeDataBound="PersonalCriteriaDownTree_NodeDataBound"
    TextMode="FullPath"
    Width="300px">
    <HeaderTemplate>
        <div class="header">
            <span style="color: red">* Words in Bold are selectable                                       
            </span>
        </div>
    </HeaderTemplate>
    <FooterTemplate>
        <div class="footer">
            <span style="color: red">* Words in Bold are selectable
 
            </span>
        </div>
    </FooterTemplate>
</telerik:RadDropDownTree>
Shinu
Top achievements
Rank 2
 answered on 15 Oct 2013
6 answers
133 views
i have 2 listbox with the transfer option and i'm showing they're results on a radgrid selectedindex changed but this items of listbox are loaded in code behind but because of the listbox's are inside a radajaxpanel it dont show any data in the radlistbox i take out the radupdatepanel and items are showed, so why with that they are not showing ... since the are loaded from the datatable i checked before with breakpoint 
Bozhidar
Telerik team
 answered on 15 Oct 2013
2 answers
144 views
Hi

I have RadGrid with DetailTables. I am exporting records in Excel.

I have used ExcelML format. It's working fine but I want the DetailTable with different background color. I also want to apply Header color to MasterTableView. But It's not working as I have used ExcelML format.

Is there any solution.?

Thanks
Kamini
Kostadin
Telerik team
 answered on 15 Oct 2013
4 answers
579 views
The function is returning no items. Following is a copy of my markup and code:

protected void Page_Load(object sender, EventArgs e)
{
    RadGrid1.DataSource = GetDataSource();
    RadGrid1.DataBind();
}
 
private DataTable GetDataSource()
{
    ...
}
 
private void AddGroupHeadersToGrid()
{
    GridItem[] header = RadGrid1.MasterTableView.GetItems(GridItemType.Header);
    //GridTHead head = ((GridTHead)header[0].Parent.Controls[0].Parent);
 
    GridHeaderItem newHeaderItem = new GridHeaderItem(RadGrid1.MasterTableView, 0, 0);
    newHeaderItem.Cells.Add(new GridTableHeaderCell());
    newHeaderItem.Cells[0].Text = "I'm a header.";
 
    //head.Controls.AddAt(0, newHeaderItem);
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    AddGroupHeadersToGrid();
}

The markup looks like this:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false"
    onprerender="RadGrid1_PreRender">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn HeaderText="Question" DataField="Question" UniqueName="Question">
            </telerik:GridBoundColumn>
             
            <telerik:GridBoundColumn HeaderText="Score" DataField="MTDScore" UniqueName="MTDScore">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Area" DataField="MTDArea" UniqueName="MTDArea">
             
            <telerik:GridBoundColumn HeaderText="Score" DataField="QTDScore" UniqueName="QTDScore">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Area" DataField="QTDArea" UniqueName="QTDArea">
             
            <telerik:GridBoundColumn HeaderText="Score" DataField="YTDScore" UniqueName="YTDScore">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Area" DataField="YTDArea" UniqueName="YTDArea">
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

I would really appreciate if somebody can tell me what I'm doing wrong here!
Princy
Top achievements
Rank 2
 answered on 15 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?