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

Getting the file UploadControlId in NestedViewTemplate in Telerik Grid

3 Answers 65 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Sailaja
Top achievements
Rank 1
Sailaja asked on 01 Nov 2010, 10:56 AM
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...

3 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 02 Nov 2010, 06:24 PM
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
0
Sailaja
Top achievements
Rank 1
answered on 03 Nov 2010, 07:09 AM
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.



0
Genady Sergeev
Telerik team
answered on 08 Nov 2010, 02:19 PM
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
Tags
Upload (Obsolete)
Asked by
Sailaja
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Sailaja
Top achievements
Rank 1
Share this question
or