How to change popup fields length ???

11 posts, 0 answers
  1. Gert Petersen
    Gert Petersen avatar
    19 posts
    Member since:
    May 2009

    Posted 16 Dec 2009 Link to this post

    Hi,

    I am using a grid with a popup ( to edit/delete/add new records )
    editformtype = autogenerated

    Is it possible to change the length of the fields in the popup window ???
    and how ?
    a screendump is attached ?

    Br
    Pettsen
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Dec 2009 Link to this post

    Hi,

    Try the following code snippet in order to change the width of the textboxes shown in the EditForm.

    CS:
     
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
            { 
                GridEditFormItem editItem = (GridEditFormItem)e.Item; 
                TextBox textbox = (TextBox)editItem["ColumnUniqueName"].Controls[0]; 
                textbox.Width = Unit.Pixel(250); 
            } 
        } 

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gert Petersen
    Gert Petersen avatar
    19 posts
    Member since:
    May 2009

    Posted 16 Dec 2009 Link to this post

    Thanks for the quick answer,

    GREAT.............. Now it works.

    1000 thanks, and a merry christmas to you, you saved mine. :-)

    Br
    Pettsen

     

  5. Gert Petersen
    Gert Petersen avatar
    19 posts
    Member since:
    May 2009

    Posted 17 Dec 2009 Link to this post



            <telerik:RadGrid ID="RadGrid10" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" 
                AllowAutomaticUpdates="True" AllowPaging="True" DataSourceID="SqlDataSource10" 
                GridLines="None" Skin="Outlook" PageSize="20" AutoGenerateColumns="False">  
                <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID" DataSourceID="SqlDataSource10" 
                    EditMode="popup">  
                    <RowIndicatorColumn>  
                        <HeaderStyle Width="20px" />  
                    </RowIndicatorColumn>  
                    <ExpandCollapseColumn>  
                        <HeaderStyle Width="20px" />  
                    </ExpandCollapseColumn>  
                    <Columns>  
                        <telerik:GridEditCommandColumn>  
                        </telerik:GridEditCommandColumn>  
                        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="column">  
                        </telerik:GridButtonColumn>  
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int64" DefaultInsertValue="" 
                            HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID">  
                        </telerik:GridBoundColumn>  
                        <telerik:GridBoundColumn DataField="LeverandorNavn" DefaultInsertValue="" HeaderText="LeverandorNavn" 
                            SortExpression="LeverandorNavn" UniqueName="LeverandorNavn">  
                        </telerik:GridBoundColumn>  
                        <telerik:GridBoundColumn DataField="Email" DefaultInsertValue="" HeaderText="Email" 
                            SortExpression="Email" UniqueName="Email" Resizable="True" DataType="System.String">  
                        </telerik:GridBoundColumn>  
                    </Columns>  
                    <EditFormSettings EditFormType="Template">  
                        <EditColumn UniqueName="EditColumn">  
                        </EditColumn>  
                        <FormTemplate>  
                            <table border="0" cellpadding="2">  
                                <tr>  
                                    <td>  
                                        Category Name:&nbsp;  
                                    </td>  
                                    <td>  
                                        <asp:TextBox ID="txtname" Width="250px" Text='<%# Bind( "LeverandorNavn") %>' runat="server"></asp:TextBox>  
                                    </td>  
                                </tr>  
                                <tr>  
                                    <td>  
                                        Description:&nbsp;  
                                    </td>  
                                    <td>  
                                        <asp:TextBox ID="txtemail" Width="250px" Text='<%# Bind( "Email") %>' runat="server"></asp:TextBox>  
                                    </td>  
                                </tr>  
                            </table>  
                            <asp:Button ID="btnUpdate" CommandName="Update" Text="Update" runat="server" />  
                            <asp:Button ID="btnCancel" CommandName="Cancel" Text="Cancel" runat="server" />  
                        </FormTemplate>  
                    </EditFormSettings>  
                </MasterTableView>  
            </telerik:RadGrid>  
            <br />  
            <asp:SqlDataSource ID="SqlDataSource10" runat="server" ConnectionString="<%$ ConnectionStrings:ECOConnectionString2 %>" 
                SelectCommand="SELECT * FROM [Leverandor] ORDER BY [LeverandorNavn]" DeleteCommand="DELETE FROM [Leverandor] WHERE [ID] = @ID" 
                InsertCommand="INSERT INTO [Leverandor] ([LeverandorNavn], [Email]) VALUES (@LeverandorNavn, @Email)" 
                UpdateCommand="UPDATE [Leverandor] SET [LeverandorNavn] = @LeverandorNavn, [Email] = @Email WHERE [ID] = @ID">  
                <DeleteParameters>  
                    <asp:Parameter Name="ID" Type="Int64" />  
                </DeleteParameters>  
                <UpdateParameters>  
                    <asp:Parameter Name="LeverandorNavn" Type="String" />  
                    <asp:Parameter Name="Email" Type="String" />  
                    <asp:Parameter Name="ID" Type="Int64" />  
                </UpdateParameters>  
                <InsertParameters>  
                    <asp:Parameter Name="LeverandorNavn" Type="String" />  
                    <asp:Parameter Name="Email" Type="String" />  
                </InsertParameters>  
            </asp:SqlDataSource> 

    Hi again,
    If i use a template to edit the grid, how can i insert records.
    Edit and delete works fine, see code.

    Br
    Pettsen
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 17 Dec 2009 Link to this post

    Hello Gert,

    Here's the link to an online demo which demonstrates on how to insert records when using a form template. This should probably help you out.
    Form Template Edit Form

    Thanks
    Princy.
  7. Gert Petersen
    Gert Petersen avatar
    19 posts
    Member since:
    May 2009

    Posted 17 Dec 2009 Link to this post

    Thank you VERY much, but i get theese errors, see attached image:

  8. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 17 Dec 2009 Link to this post

    Hi Gert,

     I suppose you write in VB.NET language - if so, you will need to use the binding expresion syntax from the DefaultVB.aspx tab of the online example.


    Best,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Gert Petersen
    Gert Petersen avatar
    19 posts
    Member since:
    May 2009

    Posted 17 Dec 2009 Link to this post

    So, it isn't possible to do it without coding ?
    ( i am trying to keep it as simple as possible )

    Br
    Gert
  10. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 17 Dec 2009 Link to this post

    Hello Gert,

    The minimal code you can have for this purpose is the conditional binding expression in question.


    Regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Gert Petersen
    Gert Petersen avatar
    19 posts
    Member since:
    May 2009

    Posted 17 Dec 2009 Link to this post

    Sorry if i seem stupid, but can you please mark the code you mean with:
    " conditional binding expression in question"

    Thanks...

    Br
    Gert
  12. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Dec 2009 Link to this post

    Hello Gert,

    Replace the binding expression of the button using its VB version as shown below:
    aspx:
    <asp:Button ID="Button1" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'   
     runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' > 
    </asp:Button> 

    Hope this helps..
    Princy.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017