G
Guest
I have a repeater with and imagebutton on a page useing VS2005 ASP.Net 2.0
<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>
<div>
<asp:ImageButton ImageUrl="button.gif" ID="ImageButton1"
runat="server" />
<p><%# Eval("Name") %></p>
</div>
</ItemTemplate>
</asp:Repeater>
if I add an SqlDataSource to the page and bind declaratively no errors Are
generated
if however I bind a data source to the repeater in code,
ConnectionStringSettings settings;
settings = ConfigurationManager.ConnectionStrings["csWebDataV3"];
SqlConnection sqlCONN = new SqlConnection();
DataSet DS = new DataSet();
sqlCONN.ConnectionString = settings.ConnectionString;
SqlCommand sqlCMD = new SqlCommand();
sqlCMD.Connection = sqlCONN;
sqlCMD.CommandText = "SELECT Name FROM DevelopmentInfo";
sqlCMD.CommandType = CommandType.Text;
SqlDataAdapter ad = new SqlDataAdapter();
ad.SelectCommand = sqlCMD;
sqlCONN.Open();
ad.Fill(DS);
sqlCONN.Close();
Repeater1.DataSource = DS;
Repeater1.DataBind();
the I get the following error:
Invalid postback or callback argument. Event validation is enabled using
<pages enableEventValidation="true"/> in configuration or <%@ Page
EnableEventValidation="true" %> in a page. For security purposes, this
feature verifies that arguments to postback or callback events originate from
the server control that originally rendered them. If the data is valid and
expected, use the ClientScriptManager.RegisterForEventValidation method in
order to register the postback or callback data for validation.
could this be a bug? or am I missing somthing.
I know if you add EnableEventValidation="false" to the page directive the
error goes away.
can anyone help or point me in the riht direction.
<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>
<div>
<asp:ImageButton ImageUrl="button.gif" ID="ImageButton1"
runat="server" />
<p><%# Eval("Name") %></p>
</div>
</ItemTemplate>
</asp:Repeater>
if I add an SqlDataSource to the page and bind declaratively no errors Are
generated
if however I bind a data source to the repeater in code,
ConnectionStringSettings settings;
settings = ConfigurationManager.ConnectionStrings["csWebDataV3"];
SqlConnection sqlCONN = new SqlConnection();
DataSet DS = new DataSet();
sqlCONN.ConnectionString = settings.ConnectionString;
SqlCommand sqlCMD = new SqlCommand();
sqlCMD.Connection = sqlCONN;
sqlCMD.CommandText = "SELECT Name FROM DevelopmentInfo";
sqlCMD.CommandType = CommandType.Text;
SqlDataAdapter ad = new SqlDataAdapter();
ad.SelectCommand = sqlCMD;
sqlCONN.Open();
ad.Fill(DS);
sqlCONN.Close();
Repeater1.DataSource = DS;
Repeater1.DataBind();
the I get the following error:
Invalid postback or callback argument. Event validation is enabled using
<pages enableEventValidation="true"/> in configuration or <%@ Page
EnableEventValidation="true" %> in a page. For security purposes, this
feature verifies that arguments to postback or callback events originate from
the server control that originally rendered them. If the data is valid and
expected, use the ClientScriptManager.RegisterForEventValidation method in
order to register the postback or callback data for validation.
could this be a bug? or am I missing somthing.
I know if you add EnableEventValidation="false" to the page directive the
error goes away.
can anyone help or point me in the riht direction.