Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0To find a literal control in Formview nested in other formviewTo find a literal control in Formview nested in other formview
Previous
 
Next
New Post
7/14/2007 2:01 PM
 

<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource3" DataKeyNames="country_code" EnableViewState="False" OnDataBound="FormView1_Databound">

<ItemTemplate>

              <table style="width: 100%"><tr><td style="font-weight: bold; vertical-align: top; width: 170px; text-align: right">

             <a href="member.aspx" class="type1">Member:</a></td>

            <td valign="top" colspan="2">

             <asp:FormView ID="FormView3" runat="server" DataSourceID="SqlDataSource4" Width="100%" OnDataBound="FormView3_DataBound" OnPreRender="FormView3_PreRender">

                       <ItemTemplate>
                                  <
table style="width: 100%" cellpadding="0" cellspacing="0">
                                  <
tr>
                                  <
td style="width: 357px" valign="top">
                                      <
asp:Literal ID="Literal1" runat="server"></asp:Literal>
                                  </
td>
                                  <
td style="width: 100px">
                                         <
asp:Image ID="Image5" runat="server" Height="90px" ImageUrl='<%# Eval("person_id", "http://amsweb.imf.org/countryinfo/getimagenodll.asp?personid={0}") %>'
                                           Width
="65px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" /></td>
                                  </
tr>
                                 </
table>
                      </
ItemTemplate>
             </
asp:FormView>
             <
asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$
ConnectionStrings:BDVOTESConnectionString %>"
                 SelectCommand="selct distint a , b ,c from table where a.ccode = @cccode ">
                    <
SelectParameters><asp:ControlParameter ControlID="FormView1" Name="ccode" PropertyName="SelectedValue" /></SelectParameters>
              </
asp:SqlDataSource>
           </
td>
           </
tr>
          </table>
</
ItemTemplate>
</
asp:FormView>

The Code behind i tried is as but unable to find the literal and image control of child formview.Please advise:

The code i am using is like this but unable to find the literal and image control(they are null always but they should nt be null) :

Ist method :

 protected void sqldatasource4_selected(object sender, SqlDataSourceStatusEventArgs e)
    {
        if(e.AffectedRows == 0)
        {
        FormView formView3 = FormView1.FindControl("FormView3") as FormView;
        Literal ltrl = formView3.FindControl("Literal1") as Literal;
            ltrl.Text = "No Records Found";
        }     
    }

2nd Method :

 protected void FormView3_DataBound(object sender, EventArgs e) //this manages missing institution display
    {     
        FormView frm = (FormView)FormView1.FindControl("FormView3");
        Literal lit = (Literal)frm.FindControl("Literal1");                              
        Image IMFCImage = (Image)frm.FindControl("Image5");
        DataRowView rowView = (DataRowView)frm.DataItem;       
       
        string badge_name = (rowView == null) ? "" : rowView["badge_name"].ToString();
        string title_dept1 = (rowView == null) ? "" : rowView["title_dept1"].ToString();
        string title_dept2 = (rowView == null) ? "" : rowView["title_dept2"].ToString();
        string institution = (rowView == null) ? "" : rowView["institution"].ToString();
        string countryNameFull = (rowView == null) ? "" : rowView["countryNameFull"].ToString();
     

   if (badge_name == "vacant" || badge_name == "Vacant" || badge_name == "")
        {
            badge_name = "vacant";        
            if (lit != null)
            {
                lit.Text = badge_name;
               IMFCImage.ImageUrl = "Images/no-view.jpg";
            }                      
        }
        else
        {

            string strLit = badge_name + "<br />" + title_dept1 + title_dept2 + "<br />";

            if (institution == "")
            {
                strLit += countryNameFull;
            }
            else
            {
                strLit += institution + "<br />" + countryNameFull;
            }

            if (lit != null)
            {
                lit.Text = strLit;
            }
        }      
    }

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0To find a literal control in Formview nested in other formviewTo find a literal control in Formview nested in other formview


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out