Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Handling DataList event from textbox changed

Posted on 2009-04-10
1
Medium Priority
?
433 Views
Last Modified: 2012-05-06
Greetings;

I need to capture the event where the user has changed the value of a textbox in a datalist row. There are no other user interactive controls other than this textbox. There are label controls in the row.

I have a ItemDataBound event routine which performs calculations involving this textbox, however, the new value of the textbox is not picked up by the ItemDataBound event.

Could my error be in expecting to access a changed textbox value defined within an ItemTemplate instead of an EditTemplate? If so, how might I get around this?

Much thanks ... David Bach
<asp:DataList ID="dlOrderSelection" runat="server" RepeatColumns="1" ShowFooter="False"
        Width="100%">
        <ItemStyle Wrap="False" />
        <HeaderTemplate>
            <table style="width: 100%;">
                <tr>
                    <td align="center" nowrap="nowrap" width="400px">
                        <asp:Literal ID="litProductName" runat="server" Text="Product Name"></asp:Literal>
                    </td>
                    <td align="center" width="100">
                        <asp:Literal ID="litSeatUnused" runat="server" Text="Seats Unused"></asp:Literal>
                    </td>
                    <td align="center" width="70">
                        <asp:Literal ID="litQuantity" runat="server" Text="Quantity"></asp:Literal>
                    </td>
                    <td align="center" width="110">
                        <asp:Literal ID="litCostPerUnit" runat="server" Text="Cost Per Unit"></asp:Literal>
                    </td>
                    <td align="center" width="90">
                        <asp:Literal ID="litTotalCost" runat="server" Text="Total Cost"></asp:Literal>
                    </td>
                </tr>
            </table>
        </HeaderTemplate>
        <ItemTemplate>
            <table id="Table4" runat="server" style="width: 100%;">
                <tr>
                    <td nowrap="nowrap" style="text-align: left" width="400px">
                        <asp:Label ID="lblProductSelect" runat="server" Text='<%# Bind("strName") %>'></asp:Label>
                    </td>
                    <td nowrap="nowrap" style="text-align: right" width="100px">
                        <asp:Label ID="lblProductCurrentUnusedSeats" runat="server" Style="text-align: right">0</asp:Label>
                    </td>
                    <td nowrap="nowrap" width="70px">
                        <asp:TextBox ID="tbxProductQuantity" runat="server" Width="70px" 
                            MaxLength="5" Style="text-align: right">0</asp:TextBox>
                    </td>
                    <td nowrap="nowrap" style="text-align: right" width="110px">
                        <asp:Label ID="lblProductPerItemCost" runat="server" Style="text-align: right">0</asp:Label>
                    </td>
                    <td style="text-align: right" width="90px">
                        <asp:Label ID="lblProductTotalItemCost" runat="server" Style="text-align: right">0</asp:Label>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:DataList>

Open in new window

0
Comment
Question by:David Bach
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 37

Accepted Solution

by:
samtran0331 earned 2000 total points
ID: 24119026
itemdatabound only fires when the datalist is bound...so you will lose any user-entered value...
your routine to loop through the datalist has to be in its own subroutine and not involve re-binding the datalist
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question