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 8563853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:03:48+00:00 2026-06-11T17:03:48+00:00

I have a grid view, where user can add a new row. On the

  • 0

I have a grid view, where user can add a new row. On the adding of row, the id’s are changed like this..

$('<div class=".grdLoaded">').load("GridRow.htm", function () {
                    // insert the html
$(_InsertionID).after($(this).html());
// now change the default id(s) that were present on GridRow.htm
// to something that represent current value(s)
$('#grdEntry').find('#grdEntry_ctl00_lblSNO').attr('id', 'SNo_' + _insCurRowNumber + '');
$('#grdEntry').find('#grdEntry_ctl00_lblQty').attr('id', 'Qty_' + _insCurRowNumber + '');
$('#grdEntry').find('#grdEntry_ctl00_lblItemName').attr('id', 'ItemName_' + _insCurRowNumber + '');
$('#grdEntry').find('#grdEntry_ctl00_lblProcess').attr('id', 'Prc_' + _insCurRowNumber + '');
$('#grdEntry').find('#grdEntry_ctl00_lblRemarks').attr('id', 'Remarks_' + _insCurRowNumber + '');
$('#grdEntry').find('#grdEntry_ctl00_lblColor').attr('id', 'Color_' + _insCurRowNumber + '');
$('#grdEntry').find('#grdEntry_ctl00_lblAmount').attr('id', 'Amount_' + _insCurRowNumber + '');

where insCurRowNumber is the current row id that is being added, for the first time its 1, second 2 and so on..
The problem is if I try to access any of these control on server, like this

((Label)grdEntry.Rows[i].FindControl("ItemName_1").Text;

or event if like this

Page.FindControl("ItemName_1")

I get a null reference exception. Seems like the issue is server side can’t find these dynamically generated id(s). If that is the cause how do I circumvent this? If its not the cause then what is causing this behavior and again, how do I find these control(s) to access their value(s)?

EDIT : In response to Steven Hunt, the request was in post format, and here’s the key’s collection.

    Request.Form.AllKeys    {string[177]}   string[]
    [0] "__EVENTTARGET" string
    [1] "__EVENTARGUMENT"   string
    [2] "__LASTFOCUS"   string
    [3] "__VIEWSTATE"   string
    [4] "__EVENTVALIDATION" string
    [5] "check" string
    [6] "txtDueDate"    string
    [7] "txtTime"   string
    [8] "txtCustomerName"   string
    [9] "grdEntry$ctl01$txtQty" string
    [10]    "grdEntry$ctl01$txtName"    string
    [11]    "grdEntry$ctl01$txtProcess" string
    [12]    "grdEntry$ctl01$txtRate"    string
    [13]    "grdEntry$ctl01$txtRemarks" string
    [14]    "tags"  string
    [15]    "grdEntry$ctl01$txtColor"   string
    [16]    "txtRemarks"    string
    [17]    "drpCheckedBy"  string
    [18]    "btnSaveBooking"    string
    [19]    "txtCurrentDue" string
    [20]    "a" string
    [21]    "txtDiscount"   string
    [22]    "txtDiscount_TextBoxWatermarkExtender_ClientState"  string
    [23]    "txtDiscountAmt"    string
    [24]    "txtSrTax"  string
    [25]    "txtTotal"  string
    [26]    "txtAdvance"    string
    [27]    "txtBalance"    string
    [28]    "txtItemName"   string
    [29]    "txtItemSubQty" string
    [30]    "txtNewItemName"    string
    [31]    "txtItemCode"   string
    [32]    "hdntemp"   string
    [33]    "hdnItemCode"   string
    [34]    "txtProcessCode"    string
    [35]    "txtProcessName"    string
    [36]    "txtCNameSearch"    string
    [37]    "txtAddress"    string
    [38]    "txtPhoneNo"    string
    [39]    "grdCustomerSearch$ctl02$lnkBtnCustomerCode"    string
    [40]    "grdCustomerSearch$ctl03$lnkBtnCustomerCode"    string
    [41]    "grdCustomerSearch$ctl04$lnkBtnCustomerCode"    string
    [42]    "grdCustomerSearch$ctl05$lnkBtnCustomerCode"    string
    [43]    "grdCustomerSearch$ctl06$lnkBtnCustomerCode"    string
    [44]    "grdCustomerSearch$ctl07$lnkBtnCustomerCode"    string
    [45]    "grdCustomerSearch$ctl08$lnkBtnCustomerCode"    string
    [46]    "grdCustomerSearch$ctl09$lnkBtnCustomerCode"    string
    [47]    "grdCustomerSearch$ctl10$lnkBtnCustomerCode"    string
    [48]    "grdCustomerSearch$ctl11$lnkBtnCustomerCode"    string
    [49]    "grdCustomerSearch$ctl12$lnkBtnCustomerCode"    string
    [50]    "grdCustomerSearch$ctl13$lnkBtnCustomerCode"    string
    [51]    "grdCustomerSearch$ctl14$lnkBtnCustomerCode"    string
    [52]    "grdCustomerSearch$ctl15$lnkBtnCustomerCode"    string
    [53]    "grdCustomerSearch$ctl16$lnkBtnCustomerCode"    string
    [54]    "grdCustomerSearch$ctl17$lnkBtnCustomerCode"    string
    [55]    "grdCustomerSearch$ctl18$lnkBtnCustomerCode"    string
    [56]    "grdCustomerSearch$ctl19$lnkBtnCustomerCode"    string
    [57]    "grdCustomerSearch$ctl20$lnkBtnCustomerCode"    string
    [58]    "grdCustomerSearch$ctl21$lnkBtnCustomerCode"    string
    [59]    "grdCustomerSearch$ctl22$lnkBtnCustomerCode"    string
    [60]    "grdCustomerSearch$ctl23$lnkBtnCustomerCode"    string
    [61]    "grdCustomerSearch$ctl24$lnkBtnCustomerCode"    string
    [62]    "grdCustomerSearch$ctl25$lnkBtnCustomerCode"    string
    [63]    "grdCustomerSearch$ctl26$lnkBtnCustomerCode"    string
    [64]    "grdCustomerSearch$ctl27$lnkBtnCustomerCode"    string
    [65]    "grdCustomerSearch$ctl28$lnkBtnCustomerCode"    string
    [66]    "grdCustomerSearch$ctl29$lnkBtnCustomerCode"    string
    [67]    "grdCustomerSearch$ctl30$lnkBtnCustomerCode"    string
    [68]    "grdCustomerSearch$ctl31$lnkBtnCustomerCode"    string
    [69]    "grdCustomerSearch$ctl32$lnkBtnCustomerCode"    string
    [70]    "grdCustomerSearch$ctl33$lnkBtnCustomerCode"    string
    [71]    "grdCustomerSearch$ctl34$lnkBtnCustomerCode"    string
    [72]    "grdCustomerSearch$ctl35$lnkBtnCustomerCode"    string
    [73]    "grdCustomerSearch$ctl36$lnkBtnCustomerCode"    string
    [74]    "grdCustomerSearch$ctl37$lnkBtnCustomerCode"    string
    [75]    "grdCustomerSearch$ctl38$lnkBtnCustomerCode"    string
    [76]    "grdCustomerSearch$ctl39$lnkBtnCustomerCode"    string
    [77]    "grdCustomerSearch$ctl40$lnkBtnCustomerCode"    string
    [78]    "grdCustomerSearch$ctl41$lnkBtnCustomerCode"    string
    [79]    "grdCustomerSearch$ctl42$lnkBtnCustomerCode"    string
    [80]    "grdCustomerSearch$ctl43$lnkBtnCustomerCode"    string
    [81]    "grdCustomerSearch$ctl44$lnkBtnCustomerCode"    string
    [82]    "grdCustomerSearch$ctl45$lnkBtnCustomerCode"    string
    [83]    "grdCustomerSearch$ctl46$lnkBtnCustomerCode"    string
    [84]    "grdCustomerSearch$ctl47$lnkBtnCustomerCode"    string
    [85]    "grdCustomerSearch$ctl48$lnkBtnCustomerCode"    string
    [86]    "grdCustomerSearch$ctl49$lnkBtnCustomerCode"    string
    [87]    "grdCustomerSearch$ctl50$lnkBtnCustomerCode"    string
    [88]    "grdCustomerSearch$ctl51$lnkBtnCustomerCode"    string
    [89]    "grdCustomerSearch$ctl52$lnkBtnCustomerCode"    string
    [90]    "grdCustomerSearch$ctl53$lnkBtnCustomerCode"    string
    [91]    "grdCustomerSearch$ctl54$lnkBtnCustomerCode"    string
    [92]    "grdCustomerSearch$ctl55$lnkBtnCustomerCode"    string
    [93]    "grdCustomerSearch$ctl56$lnkBtnCustomerCode"    string
    [94]    "grdCustomerSearch$ctl57$lnkBtnCustomerCode"    string
    [95]    "grdCustomerSearch$ctl58$lnkBtnCustomerCode"    string
    [96]    "grdCustomerSearch$ctl59$lnkBtnCustomerCode"    string
    [97]    "grdCustomerSearch$ctl60$lnkBtnCustomerCode"    string
    [98]    "grdCustomerSearch$ctl61$lnkBtnCustomerCode"    string
    [99]    "grdCustomerSearch$ctl62$lnkBtnCustomerCode"    string
    [100]   "grdCustomerSearch$ctl63$lnkBtnCustomerCode"    string
    [101]   "grdCustomerSearch$ctl64$lnkBtnCustomerCode"    string
    [102]   "grdCustomerSearch$ctl65$lnkBtnCustomerCode"    string
    [103]   "grdCustomerSearch$ctl66$lnkBtnCustomerCode"    string
    [104]   "grdCustomerSearch$ctl67$lnkBtnCustomerCode"    string
    [105]   "grdCustomerSearch$ctl68$lnkBtnCustomerCode"    string
    [106]   "grdCustomerSearch$ctl69$lnkBtnCustomerCode"    string
    [107]   "grdCustomerSearch$ctl70$lnkBtnCustomerCode"    string
    [108]   "grdCustomerSearch$ctl71$lnkBtnCustomerCode"    string
    [109]   "grdCustomerSearch$ctl72$lnkBtnCustomerCode"    string
    [110]   "grdCustomerSearch$ctl73$lnkBtnCustomerCode"    string
    [111]   "grdCustomerSearch$ctl74$lnkBtnCustomerCode"    string
    [112]   "grdCustomerSearch$ctl75$lnkBtnCustomerCode"    string
    [113]   "grdCustomerSearch$ctl76$lnkBtnCustomerCode"    string
    [114]   "grdCustomerSearch$ctl77$lnkBtnCustomerCode"    string
    [115]   "grdCustomerSearch$ctl78$lnkBtnCustomerCode"    string
    [116]   "grdCustomerSearch$ctl79$lnkBtnCustomerCode"    string
    [117]   "grdCustomerSearch$ctl80$lnkBtnCustomerCode"    string
    [118]   "grdCustomerSearch$ctl81$lnkBtnCustomerCode"    string
    [119]   "grdCustomerSearch$ctl82$lnkBtnCustomerCode"    string
    [120]   "grdCustomerSearch$ctl83$lnkBtnCustomerCode"    string
    [121]   "grdCustomerSearch$ctl84$lnkBtnCustomerCode"    string
    [122]   "grdCustomerSearch$ctl85$lnkBtnCustomerCode"    string
    [123]   "grdCustomerSearch$ctl86$lnkBtnCustomerCode"    string
    [124]   "grdCustomerSearch$ctl87$lnkBtnCustomerCode"    string
    [125]   "grdCustomerSearch$ctl88$lnkBtnCustomerCode"    string
    [126]   "grdCustomerSearch$ctl89$lnkBtnCustomerCode"    string
    [127]   "grdCustomerSearch$ctl90$lnkBtnCustomerCode"    string
    [128]   "grdCustomerSearch$ctl91$lnkBtnCustomerCode"    string
    [129]   "txtExtraProcess1"  string
    [130]   "txtExtraRate1" string
    [131]   "txtExtraProcess2"  string
    [132]   "txtExtraRate2" string
    [133]   "txtWholeRemark"    string
    [134]   "drpTitle"  string
    [135]   "txtCName"  string
    [136]   "txtCAddress"   string
    [137]   "txtMobile" string
    [138]   "drpPriority"   string
    [139]   "txtNewPriority"    string
    [140]   "txtAreaLocaton"    string
    [141]   "txtRemarks1"   string
    [142]   "txtBDate"  string
    [143]   "txtADate"  string
    [144]   "hdnMAC"    string
    [145]   "hdnEditItemId" string
    [146]   "hdnOption" string
    [147]   "hdnCustId" string
    [148]   "hdnUpdate" string
    [149]   "BranchId"  string
    [150]   "hdnItems"  string
    [151]   "hdnDataValues" string
    [152]   "hdnFirstAdd"   string
    [153]   "hdnCustomerNameFocusOut"   string
    [154]   "hdnCurrentValue"   string
    [155]   "hdnCurrentGrossAmt"    string
    [156]   "isInEditMode"  string
    [157]   "hdnDefaultItem"    string
    [158]   "hdnDefaultProcess" string
    [159]   "hdnDefaultItemProcessRate" string
    [160]   "hdnTaxBefore"  string
    [161]   "hdnAllDiscount"    string
    [162]   "hdnAllTax" string
    [163]   "hdnUrgentRateApplied"  string
    [164]   "hdnAllDiscountFocusOut"    string
    [165]   "isNetAmountInDecimal"  string
    [166]   "hdnRecompTax"  string
    [167]   "hdnRecompDiscount" string
    [168]   "hdnCustCode"   string
    [169]   "hdnTaxAmtRecomp"   string
    [170]   "hdnDisAmtRecomp"   string
    [171]   "hdnBalance"    string
    [172]   "hdnTotal"  string
    [173]   "hdnDiscountValue"  string
    [174]   "hdnGrdRowCount"    string
    [175]   "hdnAllGridData"    string
    [176]   "hiddenInputToUpdateATBuffer_CommonToolkitScripts"  string

It doesn’t contains anything but data of the header of the grid (those values with grdEntry$ctl01$txtQty, not the data of the row(s). But nonetheless, I found my way around, stored all variable in a temporary array and passed that to server, job done!
Thanks for the effort though.

  • 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-06-11T17:03:50+00:00Added an answer on June 11, 2026 at 5:03 pm

    First off, the “id” attribute doesn’t get sent back to the server on a postback, that’s what the “name” attribute is for. Second, you would want to look in the Request.Form (for post) or Request.QueryString (for get) collections for your data since they would not be bound to controls. ASP .net has to be involved in instanciating the controls, they don’t magically exist on the postback when you create them in javascript.

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

Sidebar

Related Questions

So I have a grid view with checkboxes in it. This is the code
I have a form with a textbox and a add button. The user can
I am using vb.net code. I have grid view, please see the code below:
I have a grid view on my page and I want to export it
I have a grid view in my main page and I display some data
I have a grid view control in my application. Please see the below code.
I have a grid view which contains a button in a template field. I
I have a grid view that has two simple columns, a report number and
Using the ASP.NET grid view. It displays 3 columns with 1 row for each,
I have the following page layout in my application: <Grid x:Name=ContentPanel Grid.Row=1> <ScrollViewer x:Name=ScrollViewer1

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.