Getting the file UploadControlId in NestedViewTemplate in Telerik Grid

Thread is closed for posting
4 posts, 0 answers
  1. Sailaja
    Sailaja avatar
    2 posts
    Member since:
    Jun 2012

    Posted 01 Nov 2010 Link to this post

    Hi,
    I am using a telerik grid in which I have a NestedViewTemplate
    In that I have a file upload control.
    I just want to get the upload Control ID and the filename that is being uploaded once the "Upload" button is clicked.
    How can I get it?
    Under which event I can get it?

    Here is my sample code:

    <telerik:RadGrid ID="radgrdFiles"  runat="server"....>
    <MasterTableView>

    <NestedViewTemplate>
    <asp:FileUpload ID="UploadFile" runat="server">
    <asp:ImageButton ID="imgbtnUpload" runat="server"  CommandName="Upload"onclick="imgbtnUpload_Click">
    </NestedViewTemplate>

    </MasterTableView>
    <Columns>
    ....
    </Columns>
    </telerik:RadGrid>
    I m not able to get it in button_Click event.
    Thanks in advance...
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 02 Nov 2010 Link to this post

    Hello Sailaja,

    You can try the following:

    1) Add handler for the Grid ItemCommande event
    2) Once there, check whether the current command is Upload
    3) If so, use e.Item.FindControl in order go grab an instance of the upload.

    RadUpload upload = e.Item.FindControl("RadUpload1") as RadUpload;

    Best wishes,
    Genady Sergeev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sailaja
    Sailaja avatar
    2 posts
    Member since:
    Jun 2012

    Posted 03 Nov 2010 Link to this post

    Thank you.
    Its working fine.
    But, I got one more issue.
    I am using the detailstable instead of NestedViewTemplate.
    Here,when I clicked on Expand/Collapse button of radgrid, uploaded the file and I just want to rebind the nested grid with the newly added file.
    But, I am not able to get it.(Actually it is updated in DB and the child grid is not rebinded to get the new file).
    Its working fine once i navigated to mastergrid and then this nested grid.
    I wrote in PreRender event as

     

    protected void RadGrdFilesPro_PreRender(object sender, EventArgs e)

    {

     

     

     

     

    if (!Page.IsPostBack)  

     

        this.RadGrdFilesPro.MasterTableView.Rebind(); }

     

    }
    If i dint write rebind() in !Postback(), i am unable Exp/collapse button is not working.
    Any alternative to fix this issue please.



  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 08 Nov 2010 Link to this post

    Hi Sailaja,

    Why do you use !Page.IsPostback? This will execute the rebind code only on initial page_load. It wound execute it after a file has been uploaded because it is a postback. Could you please try remove !Page.IsPostback and try again?

    Regards,
    Genady Sergeev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top