Click here to Skip to main content
15,891,607 members
Home / Discussions / C#
   

C#

 
GeneralRe: System.Argument Exception Pin
TheJudeDude26-Feb-14 10:46
TheJudeDude26-Feb-14 10:46 
GeneralRe: System.Argument Exception Pin
phil.o27-Feb-14 0:00
professionalphil.o27-Feb-14 0:00 
QuestionRe: System.Argument Exception Pin
Richard Deeming26-Feb-14 11:25
mveRichard Deeming26-Feb-14 11:25 
AnswerRe: System.Argument Exception Pin
TheJudeDude26-Feb-14 12:01
TheJudeDude26-Feb-14 12:01 
AnswerRe: System.Argument Exception Pin
Richard Andrew x6426-Feb-14 14:11
professionalRichard Andrew x6426-Feb-14 14:11 
GeneralRe: System.Argument Exception Pin
Richard Deeming27-Feb-14 1:28
mveRichard Deeming27-Feb-14 1:28 
AnswerRe: System.Argument Exception Pin
Bernhard Hiller26-Feb-14 21:13
Bernhard Hiller26-Feb-14 21:13 
QuestionMessage Closed Pin
26-Feb-14 10:11
jon15126-Feb-14 10:11 
AnswerMessage Removed Pin
26-Feb-14 10:18
mveOriginalGriff26-Feb-14 10:18 
GeneralMessage Removed Pin
26-Feb-14 10:34
jon15126-Feb-14 10:34 
GeneralMessage Removed Pin
26-Feb-14 11:21
mveOriginalGriff26-Feb-14 11:21 
AnswerMessage Removed Pin
26-Feb-14 10:57
jon15126-Feb-14 10:57 
AnswerMessage Removed Pin
26-Feb-14 11:19
mveDave Kreskowiak26-Feb-14 11:19 
GeneralMessage Removed Pin
26-Feb-14 19:00
jon15126-Feb-14 19:00 
QuestionExchange 2010 Using C# Pin
Arun Philip Reynolds26-Feb-14 9:47
Arun Philip Reynolds26-Feb-14 9:47 
QuestionHow to get Label value from parent repeater and use it for child repeater Pin
Dhyanga26-Feb-14 4:51
Dhyanga26-Feb-14 4:51 
Hi,

I have two repeaters Repeater1(parent repeater) and Repeater2 (nested repeater). The Repeater1 has two labels and Repeater 2 as shown.
C#
<asp:Repeater runat="server" ID="Repeater1" OnItemCommand="Repeater1_ItemCommand" OnItemDataBound="Repeater1_ItemDataBound">
 <HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>    
        <asp:Label ID="Category" runat="server" Font-Bold="true"><%# DataBinder.Eval(Container.DataItem,"Category").ToString().Trim()%></asp:Label>
        <asp:Label ID="Description" runat="server" Font-Bold ="true"><%# DataBinder.Eval(Container.DataItem,"Description").ToString().Trim() %></asp:Label>
		<asp:Repeater runat="server" id="Repeater2"  OnItemCommand="Repeater2_ItemCommand" OnItemDataBound="Repeater2_ItemDataBound">
			<HeaderTemplate >
			</HeaderTemplate>
			<ItemTemplate> 
					<asp:label ID="CatDesPriceRange" runat="server" Font-Bold="true" Font-Underline="true"><%# DataBinder.Eval(Container.DataItem,"PriceRanges").ToString().Trim() %></asp:label>
			</ItemTemplate> 
    </asp:Repeater>    
</ItemTemplate>
</asp:Repeater>


Now I want to use Category and Description label values as a parameters for the sql query for Repeater2. How do I get those values? Please help.
The code I am using is below :
C#
   protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetCateDescription();
            }
        }
		
		
        public void GetCateDescription(string stuID)
        {
            SqlCommand cmdList = new SqlCommand("Select distinct Category,Description from Records", cnx);
            cmdList.CommandType = CommandType.Text;
            DataSet ds = new DataSet();
            SqlDataAdapter objDA = new SqlDataAdapter(cmdList);
            objDA.Fill(ds, "Category");
            Repeater1.DataSource = ds;
            Repeater1.DataBind();  
        }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (cnx.State == ConnectionState.Closed)
            {
                cnx.Open();
            }
          
       
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                Label Category = e.Item.FindControl("Category") as Label;
                
                Repeater Repeater2 = e.Item.FindControl("Repeater2") as Repeater;
                Repeater2.DataSource =    showAllPrices(Category.Text);
                Repeater2.DataBind();              
               
            }

            
        }


But the problem is I am getting label empty..Please help.
Dhyanga


modified 26-Feb-14 15:33pm.

AnswerRe: How to get Label value from parent repeater and use it for child repeater Pin
Raj Mouli26-Feb-14 19:33
Raj Mouli26-Feb-14 19:33 
GeneralRe: How to get Label value from parent repeater and use it for child repeater Pin
Dhyanga27-Feb-14 3:15
Dhyanga27-Feb-14 3:15 
QuestionSource Code Pin
Member 1054457625-Feb-14 22:26
Member 1054457625-Feb-14 22:26 
AnswerRe: Source Code Pin
Richard MacCutchan25-Feb-14 22:29
mveRichard MacCutchan25-Feb-14 22:29 
AnswerRe: Source Code Pin
Raj Mouli26-Feb-14 19:39
Raj Mouli26-Feb-14 19:39 
AnswerRe: Source Code Pin
Bernhard Hiller26-Feb-14 21:25
Bernhard Hiller26-Feb-14 21:25 
QuestionConverting touch screen mouse events into normal mouse events Pin
Gmoff25-Feb-14 12:02
Gmoff25-Feb-14 12:02 
AnswerRe: Converting touch screen mouse events into normal mouse events Pin
Richard Andrew x6425-Feb-14 13:02
professionalRichard Andrew x6425-Feb-14 13:02 
AnswerRe: Converting touch screen mouse events into normal mouse events Pin
SoMad25-Feb-14 13:37
professionalSoMad25-Feb-14 13:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.