Click here to Skip to main content
15,902,032 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Object does not contain definition for substring. Pin
Richard Deeming21-Aug-17 0:32
mveRichard Deeming21-Aug-17 0:32 
QuestionAnything new exist to test EF repository instead of Mock lib in .Net Core Pin
Mou_kol17-Aug-17 23:46
Mou_kol17-Aug-17 23:46 
AnswerRe: Anything new exist to test EF repository instead of Mock lib in .Net Core Pin
Richard MacCutchan18-Aug-17 1:34
mveRichard MacCutchan18-Aug-17 1:34 
QuestionRich Textbox Pin
Member 1336179216-Aug-17 0:16
Member 1336179216-Aug-17 0:16 
AnswerRe: Rich Textbox Pin
Afzaal Ahmad Zeeshan16-Aug-17 1:36
professionalAfzaal Ahmad Zeeshan16-Aug-17 1:36 
QuestionASP and SQL web application help Pin
Member 1336148915-Aug-17 18:12
Member 1336148915-Aug-17 18:12 
AnswerRe: ASP and SQL web application help Pin
Richard MacCutchan15-Aug-17 21:20
mveRichard MacCutchan15-Aug-17 21:20 
QuestionUnable to delete a dynamically generated row in Repeater Pin
samflex13-Aug-17 17:23
samflex13-Aug-17 17:23 
Hello again.

This is the last installment of my project.

was using Gridview1_RowDeleting with similar code below to delete a dynamically generated row.

That worked great.

Now, I am trying to use the code below to accomplish similar function only this time, with Repeater control.

I can't get past int rowID = e.RowIndex.

Any ideas how to work around this?

Markup:

PHP
<asp:Button ID="btnDelete" runat="server" Width="70" 
 Text="Remove" CommandName="Remove" 
 CommandArgument='<%# Container.ItemIndex %>' />


I have also tried this:

sp:Button ID="btnDelete" Style="width: 120px;" runat="server" Text="Remove a row"
OnClick="btnDelete_Click" CssClass="btnclass" />


C#
otected void btnDelete_Click(object sender, EventArgs e)
{
    int rowIndex = 0;
    int rowID = e.RowIndex;
    lblTotal.Text = "0";
    if (ViewState["CurrTable"] != null)
    {
        DataTable dtCurrentTable = (DataTable)ViewState["CurrTable"];
        if (dtCurrentTable.Rows.Count > 0)
        {
            for (int i = 1; i <= Repeater1.Items.Count; i++)
            {
                TextBox tbboatregNum = (TextBox)Repeater1.Items[rowIndex].FindControl("txtboatregNum");
                TextBox tbPayerret = (TextBox)Repeater1.Items[rowIndex].FindControl("txtPayerret");
                TextBox tbCGvesselNum = (TextBox)Repeater1.Items[rowIndex].FindControl("cgaurdNumber");
                TextBox tbCGtaxpayerret = (TextBox)Repeater1.Items[rowIndex].FindControl("cguardreturnedval");
                dtCurrentTable.Rows[i - 1]["boatregNum"] = tbboatregNum.Text;
                dtCurrentTable.Rows[i - 1]["taxpayerret"] = tbPayerret.Text;
                dtCurrentTable.Rows[i - 1]["CGvesselNum"] = tbCGvesselNum.Text;
                dtCurrentTable.Rows[i - 1]["CGtaxpayerret"] = tbCGtaxpayerret.Text;
                rowIndex++;
            }

            if (e.RowIndex < dtCurrentTable.Rows.Count)
            {
                dtCurrentTable.Rows.Remove(dtCurrentTable.Rows[rowID]);
            }
        }

        ViewState["CurrTable"] = dtCurrentTable;
        Repeater1.DataSource = dtCurrentTable;
        Repeater1.DataBind();
    }

    SetPreviousData();
}


Many thanks in advance
AnswerRe: Unable to delete a dynamically generated row in Repeater Pin
Kornfeld Eliyahu Peter13-Aug-17 19:09
professionalKornfeld Eliyahu Peter13-Aug-17 19:09 
GeneralRe: Unable to delete a dynamically generated row in Repeater Pin
samflex14-Aug-17 2:18
samflex14-Aug-17 2:18 
AnswerRe: Unable to delete a dynamically generated row in Repeater Pin
Kornfeld Eliyahu Peter14-Aug-17 4:03
professionalKornfeld Eliyahu Peter14-Aug-17 4:03 
GeneralRe: Unable to delete a dynamically generated row in Repeater Pin
samflex14-Aug-17 5:06
samflex14-Aug-17 5:06 
QuestionCross site scripting poor validation for asp.net labels Pin
Member 1335715611-Aug-17 3:19
Member 1335715611-Aug-17 3:19 
AnswerRe: Cross site scripting poor validation for asp.net labels Pin
Richard Deeming13-Aug-17 23:49
mveRichard Deeming13-Aug-17 23:49 
GeneralRe: Cross site scripting poor validation for asp.net labels Pin
Member 1335715616-Aug-17 6:05
Member 1335715616-Aug-17 6:05 
GeneralRe: Cross site scripting poor validation for asp.net labels Pin
Richard Deeming16-Aug-17 10:11
mveRichard Deeming16-Aug-17 10:11 
AnswerRe: Cross site scripting poor validation for asp.net labels Pin
viprat18-May-20 23:10
viprat18-May-20 23:10 
QuestionMaintaining sessions in Web Applications with Web Api Pin
indian14310-Aug-17 8:32
indian14310-Aug-17 8:32 
AnswerRe: Maintaining sessions in Web Applications with Web Api Pin
F-ES Sitecore10-Aug-17 22:14
professionalF-ES Sitecore10-Aug-17 22:14 
QuestionWebsite down frequently in windows server 2008 standard IIS 7 Pin
ramesh1080@yahoo.co.in9-Aug-17 19:28
ramesh1080@yahoo.co.in9-Aug-17 19:28 
AnswerRe: Website down frequently in windows server 2008 standard IIS 7 Pin
Nathan Minier11-Aug-17 1:37
professionalNathan Minier11-Aug-17 1:37 
QuestionTrying to create modal dialog using jQuery Pin
indian1439-Aug-17 6:50
indian1439-Aug-17 6:50 
AnswerRe: Trying to create modal dialog using jQuery Pin
Richard Deeming9-Aug-17 8:28
mveRichard Deeming9-Aug-17 8:28 
GeneralRe: Trying to create modal dialog using jQuery Pin
indian1439-Aug-17 9:39
indian1439-Aug-17 9:39 
GeneralRe: Trying to create modal dialog using jQuery Pin
Richard Deeming9-Aug-17 9:46
mveRichard Deeming9-Aug-17 9:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.