Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 979163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:10:37+00:00 2026-05-16T04:10:37+00:00

After some help and reviewing of the code I got this working without any

  • 0

After some help and reviewing of the code I got this working without any errors. However when I push the button nothing happens, the text-box ain’t updated.

I also wounder how i can access the data inside the DataList so that I can manipulate it inside the “DataList1_ItemCommand” function.

<p>   
 <asp:TextBox ID="NameTextBox" runat="server" CssClass="textEntry" 
                TextMode="SingleLine" Rows="0" Height="20px" Width="250px" Enabled="False"></asp:TextBox>
    <asp:DataList 
         ID="DataList1" 
         runat="server" 
         RepeatColumns="1" CellPadding="4" ForeColor="#333333" 
        GridLines="Both" Height="132px" Width="427px">
        <HeaderTemplate>
            Data
        </HeaderTemplate>
        <ItemTemplate>
             <%# DataBinder.Eval(Container.DataItem, "ref") %>
             <%# DataBinder.Eval(Container.DataItem, "name") %>
             <%# DataBinder.Eval(Container.DataItem, "city") %>
             <%# DataBinder.Eval(Container.DataItem, "ip") %>
             <%# DataBinder.Eval(Container.DataItem, "timestamp") %>
             <asp:Button ID="manage" runat="server" CommandName="manageWiki" Text="Granska"  Visible="True" />
        </ItemTemplate>
        <AlternatingItemStyle BackColor="White" ForeColor="#284775" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle Font-Bold="true" Font-Names="Arial" BackColor="#5D7B9D" 
            ForeColor="White" />
        <ItemStyle Font-Names="Arial" Font-Size="Small" BackColor="#F7F6F3" 
            ForeColor="#333333" />
        <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
    </asp:DataList>
</p>

And code behind:

protected void Page_Load(object sender, EventArgs e)
{

        if (!IsPostBack)
        {
             //getSuggestions fill the DataList with data
            getSuggestions("SELECT [ref], [city], [name], [timestamp], [ip] FROM [table1] ORDER BY timestamp");
        }

}

protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
    if (e.CommandName == "manageWiki")
    { 
        //Just update the TextBox
        NameTextBox.Text = "ref that is inside the Datalist1";
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:10:37+00:00Added an answer on May 16, 2026 at 4:10 am

    Your PageLoad is a little wacky I think. You are doing DataList1.DataBind(); on the initial load with nothing assigned to DataList1 to bind.

    Also getSuggestions does a bind everytime as well. You don’t need to bind everytime assuming you don’t have ViewState disabled in the DataList control (which it looks like you don’t) or a parent control.

    Usually this error occurs if you modify the data that has been served up via client side scripting and are posting it back and it is not matching up with what the ViewState is expecting… are you sure this is all the code?

    EDIT: I suggest commenting out as much code as you can to just perform the function you are having issues with. You are posting a lot of code that is probably just clouding the issue. Get it down to a very basic subset of code and then post the code and steps to recreate because as you have it I don’t see any issues. Are you doing any javascript code that is modifying any of the data that would be posted back?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After some find and replace refactoring I ended up with this gem: const class
After some stupid musings about Klingon languages, that came from this post I began
I am new to Android and I'm after some help. Here is my Maingamepannel
After some theoretical help on the best approach for allowing a SaaS product to
After some time I wanted to update my git repo, and then something went
After some years of experience in the field, it seems to me that the
I'm after some good tips for fluent interfaces in C#. I'm just learning about
I remember first learning about vectors in the STL and after some time, I
I've been tasked with debugging a Java (J2SE) application which after some period of
I had recently a problem with oom-killer starting to kill processes after some time.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.