Link to home
Start Free TrialLog in
Avatar of solution1368
solution1368

asked on

asp.net, total sum, and validation

https://www.experts-exchange.com/questions/27868397/asp-net-c-wizard-control.html
I have above issue and already resolved, and now I have three major issues.

this is table with 4 text boxes in a row and I have 20 rows there. For validation purpose, if anything in a row is filled, e.g. qty. the user must complete the rest of that rows such as description, size, and equipment value. I prefer to use asp.net control validation if possible.
If not, javascript is acceptable.

my second issue is: I need to add total textbox at the bottom to show the total of equipment value, and total qty. so when the user types something in qty. the total textbox will be shown for the total number, same as equipment value.

my last issue is: i don't want to add something ' string inflatableTmp = "ctl00$ContentPlaceHolder1$UiFormIndoorFacility$WizardIndoorFacility$UiInventoryList2$" - how to fix it - calling the control without using that..

Thanks
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Need more markup to understand the situation

"ctl00$ContentPlaceHolder1$UiFormIndoorFacility$WizardIndoorFacility$UiInventoryList2$";

This is the name of which control?

Can u post the code for the wizard control.

And just for clarity sakes, why haven't you considered using the gridview control here?

I guess that would have been an easier option rather than using this approach.

<asp:GridView ID="gvTextBox" runat="server" AutoGenerateColumns="false" ShowHeader="false">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txt1" runat="server" Width="30px"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txt2" runat="server" Width="30px"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txt3" runat="server" Width="30px"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txt4" runat="server" Width="30px" TextMode="MultiLine"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

Open in new window

Avatar of solution1368
solution1368

ASKER

thank you for your suggestion. but i have 20 rows need to be shown for input
Can you post the html markup from the page? A couple of <tr>s. So that I can try to write the validation javascript. One more question is:

"if anything in a row is filled, e.g. qty. the user must complete the rest of that rows such as description, size, and equipment value"

This should be done on some button click right?

No. of rows should not matter you can do that using gridview also. Like this.

<asp:GridView ID="gvTextBox" runat="server" AutoGenerateColumns="false" ShowHeader="false">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txt1" runat="server" Width="30px"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txt2" runat="server" Width="30px"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txt3" runat="server" Width="30px"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txt4" runat="server" Width="30px"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

Open in new window

DataTable dtText;
DataRow dr;
            for (int i = 0; i < 20; i++)
            {
                dr = dtText.NewRow();
                dtText.Rows.Add(dr);
            }
            gvTextBox.DataSource = dtText;
            gvTextBox.DataBind();

Open in new window

Are you by any chance using jQuery?
ASKER CERTIFIED SOLUTION
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
informaniac: I really appreciate your helps. However, I think I have to stick with my codes because it is already in production website. I can't just take your gridview idea and continue the changes for solution. However, I will still give you full points because of your effort.

I will re-post the question and hopefully get more helps.

Thanks
Great Helps.