locked
Repeater only loads with DataSource Default vaule RRS feed

  • Question

  • User451945003 posted

     <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox><br />
    <asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True"></asp:TextBox>  

     <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
        <headertemplate>
        blah - blah - blah 
        </footertemplate>
        </asp:Repeater>

        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:ConnectionStringABC %>"
            SelectCommand="SELECT LinkInfo.NoID, LinkInfo.Name, etc... WHERE (LinkInfo.NoID = @L_ID)">
            <SelectParameters>
            <asp:ControlParameter ControlID="TextBox1" DefaultValue="604514" Name="L_ID" PropertyName="Text" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>


    public partial class infopages_Credentials : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
            TextBox2.Text = Request.QueryString["LID"];
            }

        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            TextBox1.Text = TextBox2.Text;
            Repeater1.DataBind();
        }
    }

    Friday, September 16, 2011 7:08 PM

Answers

  • User451945003 posted

    Stupid mistake.  I left the TextBox1 control in a different ContentPlaceHolder, when I moved it into the ContentPlaceHolder with the Repeater it loaded as expected.  Sorry for goose chase.

    Zoltac007 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 16, 2011 8:36 PM

All replies

  • User451945003 posted

    I can set the Parameter DefaultValue to any valid number and the Repeater will load the expected data but I cannot get the RepeaterDataSource to respond to any parameter value otherwise passed.  Any ideas - this must be really, really simple for smart people.  I don't get it.

    Thank you

    Zoltac007

    Friday, September 16, 2011 8:05 PM
  • User451945003 posted

    Stupid mistake.  I left the TextBox1 control in a different ContentPlaceHolder, when I moved it into the ContentPlaceHolder with the Repeater it loaded as expected.  Sorry for goose chase.

    Zoltac007 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 16, 2011 8:36 PM