This is a migrated thread and some comments may be shown as answers.

HOW TO EDIT RADGRID ??

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 14 Aug 2008, 06:31 AM

Hi,
I can edit radgrid In Forms Editing Mode, then I can update all columns but I have problem with one column. "HİZMET KODU" column like "Products" have many items so user have to select on modal products form, instead of write product name manually.  I can not open radwindow on RadGrid. On the screenshot , I only open javascript modal window, but ı cant set value from this modal form to the radgrid edit form textbox. Are there any example for this situation ?

http://img393.imageshack.us/my.php?image=telerikkh4.jpg

Here is the source code:
<telerik:RadGrid ID="RadGrid1" runat="server"  Skin="Inox" AllowPaging="True" AllowSorting="True"
                     AutoGenerateColumns="False" Width="97%" OnNeedDataSource="RadGrid1_NeedDataSource"
                     AllowAutomaticDeletes="True"  AllowAutomaticUpdates="True"
                     OnDeleteCommand="RadGrid1_DeleteCommand" OnInsertCommand="RadGrid1_InsertCommand"
                     OnUpdateCommand="RadGrid1_UpdateCommand" OnDataBound="RadGrid1_DataBound" OnItemCreated="RadGrid1_ItemCreated" >
    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
    <MasterTableView DataKeyNames="ORLREF" GridLines="None" Width="100%" CommandItemDisplay ="Top" >
        <Columns>
            <telerik:GridButtonColumn ConfirmText="Delete this product?" ButtonType="ImageButton"
                        ImageUrl="images/Delete.gif" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
            </telerik:GridButtonColumn>
            <telerik:GridBoundColumn DataField="ORLREF" HeaderText="REF NO." UniqueName="ORLREF" ReadOnly="True">
            </telerik:GridBoundColumn>
           
            <telerik:GridTemplateColumn  HeaderText="HİZMET KODU" UniqueName="CODE">
                <EditItemTemplate>
                    <telerik:RadTextBox ID="textbox1" runat="server" Text='<%# Bind("CODE")%>'></telerik:RadTextBox>
                    <asp:Button Runat="server" ID="ServerButton" Text="Show dialog" cssclass="button" style="width:250px;" OnClick="ServerButton_Click"></asp:Button>
                </EditItemTemplate>
               
                <ItemTemplate>    
                    <%#Eval("CODE")%>    
                </ItemTemplate>
            </telerik:GridTemplateColumn>
           
            <telerik:GridBoundColumn DataField="DEFINITION_" HeaderText="A&#199;IKLAMASI" UniqueName="DEFINITION_">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="AMOUNT" HeaderText="MİKTAR" UniqueName="AMOUNT">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PRICE" HeaderText="BİRİM FİYAT" UniqueName="PRICE">
            </telerik:GridBoundColumn>
           
            <telerik:GridTemplateColumn HeaderText="KDV DAHİL/HARİ&#199;" UniqueName="KDV">
                 <EditItemTemplate>    
                    <telerik:RadComboBox ID="RadComboBox1" AppendDataBoundItems="true" Height="200px" runat="server"    
                    DataTextField="KDV" DataValueField="KDV" SelectedValue='<%# Bind("KDV")%>'>     
                        <Items>    
                            <telerik:RadComboBoxItem Text="" Value="" />
                            <telerik:RadComboBoxItem Text="Hariç" Value="HARİÇ" />    
                            <telerik:RadComboBoxItem Text="Dahil" Value="DAHİL" />
                        </Items>    
                    </telerik:RadComboBox>    
                </EditItemTemplate>    
                <ItemTemplate>    
                    <%#Eval("KDV")%>    
                </ItemTemplate>  
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="VAT" HeaderText="KDV ORANI" UniqueName="VAT">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="TOTAL" HeaderText="TUTAR" UniqueName="TOTAL" ReadOnly="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SPECODE" HeaderText="FATURALANACAK" UniqueName="SPECODE">
            </telerik:GridBoundColumn>
            <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
        </Columns>
        <EditFormSettings ColumnNumber="2" CaptionFormatString="Satırı D&#252;zenle {0}" CaptionDataField="LOGICALREF">
            <FormTableItemStyle Wrap="False"></FormTableItemStyle>
            <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
            <FormMainTableStyle CellSpacing="0" CellPadding="3" Width="100%" />
            <FormTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="2" CssClass="module" Height="110px" Width="100%" />
            <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
            <FormStyle Width="100%" BackColor="#EEF2EA"></FormStyle>
                <EditColumn UpdateText="G&#252;ncelle" UniqueName="EditCommandColumn1" CancelText="D&#252;zenlemekten Vazge&#231;">
                </EditColumn>
            <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
        </EditFormSettings>
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
        <RowIndicatorColumn>
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
        <CommandItemSettings AddNewRecordText="Yeni Kayıt Ekle" />
    </MasterTableView>
    </telerik:RadGrid>

CodeBehind Source Code

protected

void ServerButton_Click(object sender, EventArgs e)

{

string popupScript = "<script language='javascript'>" +

"window.showModalDialog('SrvCards.aspx', 'CustomPopUp','dialogWidth:255px;dialogHeight:250px;scrollbars=yes'); " +

"</script>";

Page.RegisterStartupScript(

"PopupScript", popupScript);

}

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 15 Aug 2008, 02:26 PM
Hello Ali,

This example demonstrates how to use RadWindow for editing RadGrid records

Sincerely yours,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Ali
Top achievements
Rank 1
Answers by
Missing User
Share this question
or