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

Ajax not updating image url plus other problems

2 Answers 52 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Atiq Ur Rehman
Top achievements
Rank 1
Atiq Ur Rehman asked on 16 Dec 2010, 07:13 PM
Hi,

ok here is my scenario.

I am using MasterPage. In one of the page, I have a form which collects lots of data and is inside RadAjaxPanel. There is a RadWindowManager as well on the page. It is basically a jobsite form so I am trying to upload CV from upload button. The upload button opens another window to upload your cv and Rebinds the AjaxPanel and updates the cv name to a label and makes View/Delete buttons visible so you can view or delete the cv you have uploaded. This works fine, however when I click View it doesn't open the CV. This should open a ms word or pdf file (uploaded by user) but this is not happening. I have included code to exclude this button to Ajax but still not working.

The other problem is there is another upload button which when clicked opens a window and user can upload his picture. The picture is uploaded and window is closed and then hits Rebind Ajaxpanel event. In the event, I have an ASP IMAGE and I am trying to give it url of the uploaded image but this doesn't work either. I can see that CV and Image are uploaded fine but just doesn't work.

Here is some sample code;

Profile.aspx


<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
        <script type="text/javascript">
     
            function refreshCV(arg) {
                $find("<%= RadAjaxPanel1.ClientID %>").ajaxRequest("RebindCV");
            }
 
            function refreshImg(arg) {
                $find("<%= RadAjaxPanel1.ClientID %>").ajaxRequest("RebindImg");
            }
             
            function RequestStart(sender, args) {
                if (args.EventTarget == "lnkCvDownload") {
                    args.EnableAjax = false;
                }
            }
 
            Telerik.Web.UI.RadWindowUtils.Localization =
       {
           "Close": "Close",
           "Minimize": "Minimize",
           "Maximize": "Maximize",
           "Reload": "Reload",
           "PinOn": "Pin on",
           "PinOff": "Pin off",
           "Restore": "Restore",
           "OK": "Yes",
           "Cancel": "No",
           "Yes": "Yes",
           "No": "No"
       };
 
        
        </script>
</telerik:RadCodeBlock>   
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager
 
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="100%" LoadingPanelID="RadAjaxLoadingPanel1" OnAjaxRequest="RadAjaxPanel1_AjaxRequest">  
    <telerik:RadWindowManager ID="RadWindowManager1" Skin="Vista" runat="server" Behavior="Close" VisibleTitlebar="True" VisibleStatusbar="False">
    </telerik:RadWindowManager>
    
    
        <div id="left_container" class="equal_height01">
          <div id="quick-search"> <a href="#" class="tab01">Nanny agency directory</a> <a href="#" class="tab-active">Nanny agency directory</a>
            <div class="main-navigation">
            <ul>
             <li><a>Search Jobs</a></li>
              <li><a>Post a job</a></li>
              <li><a>Post Your CV</a></li>
              <li><a>Search CVs </a></li>
              <li><a class="lastchild">Jobs by email</a></li>
              </ul>
            </div>
          </div>
          <div id="nannie-inner-left">
            <h2>Nanny Profile and CV</h2>
            <div class="info-text">Edit your profile and upload your CV and then click on the Save button.</div>
            <!-- Begin: textfild -->
             
            <ul class="profileinfo">
              <li>
                <span class="sidelistheading">Settings:</span><ul class="fff">
                   
                  <li>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="20" align="left" valign="middle">
                            <asp:CheckBox ID="chAllowRecruiters" runat="server" />
                            </td>
                        <td width="317" align="left" valign="middle" class="textupper">Allow recruiters to view my profile and CV</td>
                        <td width="19" align="left" valign="middle">
                        <asp:CheckBox ID="chRecruitment" runat="server" /></td>
                        <td align="left" valign="middle" class="textupper">Recruitment agencies only</td>
                      </tr>
                    </table>
                  </li>
                </ul>
              </li>
            </ul>
            <ul class="profileinfo">
              <li>
               <span class="sidelistheading">Contact Details:</span> <ul class="fff">
                   
                  <li>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="120">FirstName:</td>
                        <td height="40" align="left" valign="top"><div class="contactdetal-profiltext-feald">
                            <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtFirstName"></asp:RequiredFieldValidator>                         
                          </div>
                           </td>
                      </tr>
                      <tr>
                        <td>Last Name:</td>
                        <td height="40" align="left" valign="top"><div class="contactdetal-profiltext-feald">
                        <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>   
                         <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtLastName"></asp:RequiredFieldValidator>                          
                          </div></td>
                      </tr>
                      <tr>
                        <td>Telephone Number:</td>
                        <td><div class="contactdetal-profiltext-feald">
                        <asp:TextBox ID="txtTelephoneNumber" runat="server"></asp:TextBox>
                          </div></td>
                      </tr>
                    </table>
                  </li>
                </ul>
              </li>
            </ul>
            <ul class="profileinfo">
              <li>
                <span class="sidelistheading">Your Details:</span><ul class="fff">
                   
                  <li>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td colspan="5" align="left" valign="top">
                        <table width="390" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="290" height="30" align="left" valign="top">
                              Are you a UK citizen or eligible to work in the UK?</td>
                            <td width="100" align="left" valign="top">
                                <asp:RadioButtonList ID="rblIsUkCitizen" Width="100" RepeatDirection="Horizontal" runat="server">
                                <asp:ListItem Value="1" Text="Yes"></asp:ListItem>
                                <asp:ListItem Value="0" Text="No"></asp:ListItem>
                                </asp:RadioButtonList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="rblIsUkCitizen"></asp:RequiredFieldValidator>
                            </td>
                          </tr>
                          <tr>
                            <td height="30" align="left" valign="top">Are you able to drive?</td>
                            <td width="100" align="left" valign="top">
                                <asp:RadioButtonList ID="rblCanDrive" Width="100" RepeatDirection="Horizontal" runat="server">
                                <asp:ListItem Value="1" Text="Yes"></asp:ListItem>
                                <asp:ListItem Value="0" Text="No"></asp:ListItem>
                                </asp:RadioButtonList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="rblCanDrive"></asp:RequiredFieldValidator>
                            </td>
                          </tr>
                          <tr>
                            <td height="30" align="left" valign="top">
                            Do you have contactable references?</td>
                           <td width="100" align="left" valign="top">
                                <asp:RadioButtonList ID="rblIsReferences" Width="100" RepeatDirection="Horizontal" runat="server">
                                <asp:ListItem Value="1" Text="Yes"></asp:ListItem>
                                <asp:ListItem Value="0" Text="No"></asp:ListItem>
                                </asp:RadioButtonList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="rblIsReferences"></asp:RequiredFieldValidator>
                            </td>
                          </tr>
                          <tr>
                            <td height="30" align="left" valign="top">Do you have a CRB check?</td>
                            <td width="100" align="left" valign="top">
                                <asp:RadioButtonList ID="rblIsCRBCheck" Width="100" RepeatDirection="Horizontal" runat="server">
                                <asp:ListItem Value="1" Text="Yes"></asp:ListItem>
                                <asp:ListItem Value="0" Text="No"></asp:ListItem>
                                </asp:RadioButtonList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="rblIsCRBCheck"></asp:RequiredFieldValidator>   
                            </td>
                          </tr>
                          <tr>
                            <td height="46" align="left" valign="top">Do you have a 1st Aid Certificate?</td>
                            <td width="100" align="left" valign="top">
                                <asp:RadioButtonList ID="rblIsFirstAid" Width="100" RepeatDirection="Horizontal" runat="server">
                                <asp:ListItem Value="1" Text="Yes"></asp:ListItem>
                                <asp:ListItem Value="0" Text="No"></asp:ListItem>
                                </asp:RadioButtonList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="rblIsFirstAid">
                            </asp:RequiredFieldValidator>    
                            </td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td height="40" colspan="5" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                            <td width="72">Experience:</td>
                            <td width="48"><div class="tini-textfild">
                                <asp:TextBox ID="txtExperience" runat="server"></asp:TextBox>
                              </div></td>
                            <td class="gray-color">Years
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtExperience">
                            </asp:RequiredFieldValidator></td>
                          </tr>
                          </table></td>
                      </tr>
                      <tr>
                        <td height="39" colspan="5" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                            <td width="105">Available to Work:</td>
                            <td>
                  <div class="select-list ">
                  <div class="homepage-select">
                      <asp:DropDownList ID="ddlAvailableToWork" CssClass="select-group-four" runat="server">
                      <asp:ListItem Value="Available" Text="Available"></asp:ListItem>
                      <asp:ListItem Value="Within One Week" Text="Within One Week"></asp:ListItem>
                      <asp:ListItem Value="Within Two Weeks" Text="Within Two Weeks"></asp:ListItem>
                      <asp:ListItem Value="Within One Month" Text="Within One Month"></asp:ListItem>
                      </asp:DropDownList>
                  </div>
                </div></td>
                          </tr>
                          </table></td>
                      </tr>
                      <tr>
                        <td height="65" colspan="5" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                            <td width="32">For:</td>
                            <td width="48"><div class="tini-textfild">
                             <asp:TextBox ID="txtAvailable" runat="server"></asp:TextBox>                                                    
                              </div></td>
                            <td class="gray-color">Months (leave blank if you are available indefinitely)
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator9" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtAvailable">
                            </asp:RequiredFieldValidator>
                            </td>
                          </tr>
                          </table></td>
                      </tr>
                      <tr>
                        <td height="29" colspan="5" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                            <td width="121">Area :</td>
                            <td width="20" align="left" valign="top">
                                <asp:RadioButton ID="rblEurope" Checked="true" GroupName="area" runat="server" />
                            </td>
                            <td width="63" align="left" valign="middle" class="gray-color-01">Europe</td>
                            <td width="19" align="left" valign="top" class="gray-color">
                            <asp:RadioButton ID="tblMiddleEast" GroupName="area" runat="server" />
                            </td>
                            <td width="87" align="left" valign="middle" class="gray-color-01">Middle East</td>
                            <td width="19" align="left" valign="top" >
                            <asp:RadioButton ID="rblRussia" GroupName="area" runat="server" /></td>
                            <td width="63" align="left" valign="middle" class="gray-color-01">Russia</td>
                            <td width="20" align="left" valign="top" class="gray-color">
                            <asp:RadioButton ID="rblRestOfWorld" GroupName="area" runat="server" /></td>
                            <td align="left" valign="middle" class="gray-color-01">The rest of the World</td>
                          </tr>
                          </table></td>
                      </tr>
                      <tr>
                        <td height="46" colspan="5" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                            <td width="120" valign="top" class="dd">Languages Spoken:</td>
                            <td height="41" align="left" valign="top"><div class="contactdetal-profiltext-feald">
                             <asp:TextBox ID="txtLanguages" runat="server"></asp:TextBox
                             <asp:RequiredFieldValidator ID="RequiredFieldValidator10" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtLanguages">
                            </asp:RequiredFieldValidator>    
                              </div></td>
                          </tr>
                            <tr>
                            <td valign="top" class="dd">Current Location:</td>
                            <td height="41" align="left" valign="top"><div class="contactdetal-profiltext-feald">
                                <asp:TextBox ID="txtCurrentLocation" runat="server"></asp:TextBox>  
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator11" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtCurrentLocation">
                            </asp:RequiredFieldValidator>  
                              </div></td>
                          </tr>
                            <tr>
                            <td valign="top" class="dd">Short Description:</td>
                            <td height="91" align="left" valign="top"><div class="jobdetail-textfild-03-03">
                                <asp:TextBox ID="txtShortDescription" Width="270" Height="67" runat="server" CssClass="jobdetail-textfild-03-help" TextMode="MultiLine"></asp:TextBox>     
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator12" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtShortDescription">
                            </asp:RequiredFieldValidator>
                              </div></td>
                          </tr>
                            <tr>
                            <td valign="top" class="dd">Experience:</td>
                            <td height="91" align="left" valign="top"><div class="jobdetail-textfild-03-03">
                                <asp:TextBox ID="txtExperienceDescription" Width="270" Height="67" runat="server" CssClass="jobdetail-textfild-03-help" TextMode="MultiLine"></asp:TextBox>     
                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator13" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtExperienceDescription">
                            </asp:RequiredFieldValidator>
                              </div></td>
                          </tr>
                            <tr>
                            <td valign="top" class="dd">Qualifications:</td>
                            <td height="91" align="left" valign="top"><div class="jobdetail-textfild-03-03">
                          <asp:TextBox ID="txtQualificationDescription" Width="270" Height="67" runat="server" CssClass="jobdetail-textfild-03-help" TextMode="MultiLine"></asp:TextBox>     
                           <asp:RequiredFieldValidator ID="RequiredFieldValidator14" Display="Dynamic" runat="server" ErrorMessage="* Required" ControlToValidate="txtQualificationDescription">
                            </asp:RequiredFieldValidator>
                              </div></td>
                          </tr>
                            <tr>
                            <td valign="top" class="dd"> </td>
                            <td align="left" valign="top">
                                <asp:CheckBox ID="chShowPublicily" runat="server" />
                                <span class="gray-color-02">Show Description, Experience and Qualifications publicly</span></td>
                          </tr>
                          </table></td>
                      </tr>
                    </table>
                  </li>
                </ul>
              </li>
            </ul>
            <ul class="profileinfo">
              <li>
                <span class="sidelistheading">Your CV: </span><ul class="fff">
                   
                  <li>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                      <td align="left" valign="middle">
                      <asp:Panel ID="cvpanel" runat="server">
                       <asp:Literal ID="ltCvText" runat="server"></asp:Literal>
                         <asp:LinkButton ID="lnkCvDownload" runat="server" CausesValidation="false" OnClick="lnkCvDownload_Click">(view)</asp:LinkButton>   
                         <asp:LinkButton ID="lnkCvDelete" runat="server" CausesValidation="false" OnClick="lnkCvDelete_Click">(delete)</asp:LinkButton>                         
                       </asp:Panel>
                      </td>
                        <td width="74" align="left" valign="middle">                       
                        <asp:Button ID="btnUploadCV" runat="server" Text="Upload" CausesValidation="false" onclick="btnUploadCV_Click" CssClass="upload-button" />    
                        </td>
                        <td align="left" valign="middle" class="gray-color">(.doc, .docx, .pdf) 
                        <asp:Literal ID="ltCVUploadMsg" runat="server"></asp:Literal>
                        </td>
                      </tr>
                    </table>
                  </li>
                </ul>
              </li>
            </ul>
              <ul class="profileinfo">
              <li>
                <span class="sidelistheading">Your Photo: </span><ul class="fff">
                   
                  <li>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="74" height="36" align="left" valign="top">
                            <asp:Image ID="imgUploaded" runat="server" />
                        <asp:Button ID="btnUploadImage" CausesValidation="false" runat="server" OnClick="btnUploadImage_Click" Text="Upload" CssClass="upload-button" />
                        </td>
                        <td align="left" valign="top" class="gray-color-03">(.jpg, .gif, .png) 
                        <asp:Literal ID="ltImgUploadMsg" runat="server"></asp:Literal></td>
                      </tr>
                      <%--<tr>
                        <td colspan="2" align="left" valign="top">
                            <asp:CheckBox ID="chShowImage" runat="server" />
                                <span class="gray-color-02">Show photo publicly</span></td>
                      </tr>--%>
                    </table>
                  </li>
                </ul>
              </li>
            </ul>
               <ul class="profileinfo">
              <li>
                <span class="sidelistheading">Select Your Criteria: </span><ul class="fff">
 
                   
                  <li>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="94" height="26" align="left" valign="top"><table width="300" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="56" align="left" valign="middle">Hours:</td>
                            <td width="21" align="left" valign="middle">
                                <asp:CheckBox ID="chFullTime" runat="server" />
                            </td>
                            <td width="76" align="left" valign="middle" class="gray-color-05">Full-time</td>
                            <td width="20" align="left" valign="middle">
                            <asp:CheckBox ID="chPartTime" runat="server" /></td>
                            <td align="left" valign="middle" class="gray-color">Part-time</td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td height="35" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="69" align="left" valign="middle">Job Type:</td>
                            <td width="21" align="left" valign="middle">
                            <asp:CheckBox ID="chPermanent" runat="server" /></td>
                            <td width="81" align="left" valign="middle" class="gray-color-05">Permanent</td>
                            <td width="20" align="left" valign="middle">
                             <asp:CheckBox ID="chTemporty" runat="server" /></td>
                            <td align="left" valign="middle" class="gray-color-05">Temporary/Contract</td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td height="21" align="left" valign="top" >Specialism :</td>
                      </tr>
                      <tr>
                        <td height="19" align="left" valign="top" class="gray-color-04">Nanny & Childcare</td>
                      </tr>
                      <tr>
                        <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="27" align="left" valign="top"></td>
                            <td width="159" height="9" align="left" valign="top" class="gray-color"></td>
                            <td width="26" align="left" valign="top"></td>
                            <td width="127" align="left" valign="top" class="gray-color"></td>
                            <td width="26" align="left" valign="top"></td>
                            <td align="left" valign="top" class="gray-color"></td>
                          </tr>
                          <tr>
                            <td width="27" align="left" valign="top"><asp:CheckBox ID="chAuPair" runat="server" /></td>
                            <td width="159" height="30" align="left" valign="top" class="gray-color-05">Au Pair </td>
                            <td width="26" align="left" valign="top"><asp:CheckBox ID="chBabySitter" runat="server" /></td>
                            <td width="127" align="left" valign="top" class="gray-color-05">Babysitter </td>
                            <td width="26" align="left" valign="top"><asp:CheckBox ID="chChildminder" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Childminder </td>
                          </tr>
                          <tr>
                            <td align="left" valign="top"><asp:CheckBox ID="chDoula" runat="server" /></td>
                            <td height="30" align="left" valign="top" class="gray-color-05">Doula</td>
                            <td align="left" valign="top"><asp:CheckBox ID="chMaternity" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Maternity Nurse </td>
                            <td align="left" valign="top"><asp:CheckBox ID="chMothers" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Mothers/Fathers Help</td>
                          </tr>
                          <tr>
                            <td align="left" valign="top"><asp:CheckBox ID="chNannyLiveIn" runat="server" /></td>
                            <td height="30" align="left" valign="top" class="gray-color-05">Nanny (live-in) </td>
                            <td align="left" valign="top"><asp:CheckBox ID="chNannyLiveOut" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Nanny (live-out) </td>
                            <td align="left" valign="top"><asp:CheckBox ID="chNannyHousekeeper" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Nanny/Housekeeper </td>
                          </tr>
                          <tr>
                            <td align="left" valign="top"><asp:CheckBox ID="chNannyPersonal" runat="server" /></td>
                            <td height="30" align="left" valign="top" class="gray-color-05">Nanny/Personal Assistant </td>
                            <td align="left" valign="top"><asp:CheckBox ID="chNightNanny" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Night Nanny </td>
                            <td align="left" valign="top"><asp:CheckBox ID="chResortChildcare" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Resort Childcare </td>
                          </tr>
                          <tr>
                            <td align="left" valign="top"><asp:CheckBox ID="chSecialNeeds" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Special Needs Childcare</td>
                            <td align="left" valign="top"><asp:CheckBox ID="chOthers" runat="server" /></td>
                            <td align="left" valign="top" class="gray-color-05">Other </td>
                            <td align="left" valign="top"> </td>
                            <td align="left" valign="top" class="gray-color"> </td>
                          </tr>
                        </table></td>
                      </tr>
                    </table>
                  </li>
                </ul>
              </li>
            </ul>
                         <ul class="profileinfo">
              <li>
                <div class="sidelistheading">
                    <asp:Button ID="btnSubmit" runat="server" Text="SAVE" CssClass="save-btn"
                        onclick="btnSubmit_Click" />
                 <%--<input name="" type="button" class="cancel-btn" value="CANCEL">--%></div>
 
                  </li>
                </ul>
   
             </div>
           
 
          <!-- end: textfild -->
        </div>
    
 
</telerik:RadAjaxPanel>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
    Width="75px" Transparency="30">
    <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
        style="border: 0px;" />
</telerik:RadAjaxLoadingPanel>
</asp:Content>

Profile.aspx.cs

public partial class NannyProfile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.User.Identity.IsAuthenticated == false)
            Response.Redirect("~/login.aspx");
 
        if (!IsPostBack)
        {           
            applyLocalisation();
            bindData();
        }
    }
 
    void applyLocalisation()
    {
        this.Page.Title = "Complete your profile";        
    }
 
    void bindData()
    {
        cvpanel.Visible = false;
        imgUploaded.Visible = false;
        MembershipUserCollection muc = Membership.FindUsersByName(Page.User.Identity.Name);
        MembershipUser mu = muc[Page.User.Identity.Name];
        if (mu != null)
        {
            NJC.Business.NannyProfile.NannyProfile nf = NannyProfileManager.GetNannyProfileByUserId((Guid)mu.ProviderUserKey);
            if (nf != null)
            {
                txtFirstName.Text = nf.FirstName;
                txtLastName.Text = nf.LastName;
            }
        }       
    }
 
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
 
        }
    }
 
    protected void btnUploadCV_Click(object sender, EventArgs e)
    {
        RadWindow rw = new RadWindow();
        rw.ID = "rw1";
        rw.VisibleOnPageLoad = true;
        rw.Width = Unit.Pixel(460);
        rw.Height = Unit.Pixel(50);
        rw.OnClientClose = "refreshCV";
        rw.NavigateUrl = "~/uploadfile.aspx?uploadtype=cv";
        rw.ReloadOnShow = true;       
        WindowBehaviors wb = new WindowBehaviors();
        wb = WindowBehaviors.Close;
        rw.Behaviors = wb;
        rw.Skin = "Vista";       
        RadWindowManager1.Windows.Add(rw);
    }
 
    protected void btnUploadImage_Click(object sender, EventArgs e)
    {
        RadWindow rw = new RadWindow();
        rw.ID = "rw1";
        rw.VisibleOnPageLoad = true;
        rw.Width = Unit.Pixel(460);
        rw.Height = Unit.Pixel(50);
        rw.OnClientClose = "refreshImg";
        rw.NavigateUrl = "~/uploadfile.aspx?uploadtype=image";
        rw.ReloadOnShow = true;
        WindowBehaviors wb = new WindowBehaviors();
        wb = WindowBehaviors.Close;
        rw.Behaviors = wb;
        rw.Skin = "Vista";
        RadWindowManager1.Windows.Add(rw);
    }
 
    protected void RadAjaxPanel1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        if (e.Argument == "RebindCV")
        {
            MembershipUserCollection muc = Membership.FindUsersByName(Page.User.Identity.Name);
            MembershipUser mu = muc[Page.User.Identity.Name];
            NJC.Business.NannyProfile.NannyCvCollection ncc = NannyProfileManager.GetNannyCvByUserId((Guid)mu.ProviderUserKey);
            if (ncc.Count == 0)
            {
                NannyCv nc = ncc[0];
                ltCvText.Text = nc.CvPublicName; //"<a href=\"" + Server.MapPath("~/uploads/cvs/") + nf.CvLink + "\">" + nf.CvPublicName + "</a>";
                ltCVUploadMsg.Text = "CV Uploaded.";
                cvpanel.Visible = true;
            }
        }
        else if (e.Argument == "RebindImg")
        {
            MembershipUserCollection muc = Membership.FindUsersByName(Page.User.Identity.Name);
            MembershipUser mu = muc[Page.User.Identity.Name];
            NJC.Business.NannyProfile.NannyPicturesCollection npc = NannyProfileManager.GetNannyPicturesByUserId((Guid)mu.ProviderUserKey);
            if (npc.Count == 1)
            {
                NannyPictures np = npc[0];
                imgUploaded.ImageUrl = System.Configuration.ConfigurationManager.AppSettings["websiteaddress"].ToString() + "uploads/images/" + np.ImgName; //"<a href=\"" + Server.MapPath("~/uploads/cvs/") + nf.CvLink + "\">" + nf.CvPublicName + "</a>";
                ltImgUploadMsg.Text = "Image Uploaded.";
            }
        }
    }
 
 
    protected void lnkCvDownload_Click(object sender, EventArgs e)
    {
        MembershipUserCollection muc = Membership.FindUsersByName(Page.User.Identity.Name);
        MembershipUser mu = muc[Page.User.Identity.Name];
        if (mu != null)
        {
            NJC.Business.NannyProfile.NannyCvCollection ncc = NannyProfileManager.GetNannyCvByUserId((Guid)mu.ProviderUserKey);
            if (ncc.Count == 0)
            {
                NannyCv nc = ncc[0];
                if (!string.IsNullOrEmpty(nc.CvName))
                {                    
                    System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath("~/uploads/cvs/" + nc.CvName));
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + nc.CvPublicName);
                    Response.AddHeader("Content-Length", file.Length.ToString());
                    Response.ContentType = nc.ContentType;
                    Response.WriteFile(file.FullName);
                    Response.End();
                }
            }
        }       
    }
 
    protected void lnkCvDelete_Click(object sender, EventArgs e)
    {
        MembershipUserCollection muc = Membership.FindUsersByName(Page.User.Identity.Name);
        MembershipUser mu = muc[Page.User.Identity.Name];
        if (mu != null)
        {
            NJC.Business.NannyProfile.NannyCvCollection ncc = NannyProfileManager.GetNannyCvByUserId((Guid)mu.ProviderUserKey);
            if (ncc.Count == 0)
            {
                NannyCv nc = ncc[0];
                if (!string.IsNullOrEmpty(nc.CvName))
                {
                    System.IO.File.Delete(Server.MapPath("~/uploads/cvs/" + nc.CvName));
                    if (NannyProfileManager.DeleteNannyCv(nc.NannyCvsId))
                    {
                        ltCvText.Text = ""; //"<a href=\"" + Server.MapPath("~/uploads/cvs/") + nf.CvLink + "\">" + nf.CvPublicName + "</a>";
                        ltCVUploadMsg.Text = "CV Deleted.";
                        cvpanel.Visible = false;
                    }
                    else
                    {
                        ltCVUploadMsg.Text = "An internal error has occured.";
                    }
                }
            }
        
    }
 
}

The upload file works fine and uploads the CV and image files. I have tried every approach to un-ajaxify the cv download button but that doesn't work and even when I assign the url to image, it doesn't show the image.

Please help me out with this.

2 Answers, 1 is accepted

Sort by
0
Atiq Ur Rehman
Top achievements
Rank 1
answered on 16 Dec 2010, 07:24 PM
Ok image is working now, it's just the cv button which won't view the uploaded cv. please help
0
Tsvetina
Telerik team
answered on 22 Dec 2010, 09:07 AM
Hi,

Could you please confirm if when debugging the program, the debugger actually hits the place in code where you work with the CV button? Also, have you tested your scenario without AJAX to confirm that everything is working fine? You can turn off AJAX by setting EnableAJAX="false" in the RadAjaxPanel.


All the best,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Ajax
Asked by
Atiq Ur Rehman
Top achievements
Rank 1
Answers by
Atiq Ur Rehman
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or