Ok, I think the problem is here, not necessarily your problem but I may have missed something here because right now, when I click the NEXT page, it loads the form correctly except that the value of MarineRegNo and VesselRegNo in Repeater1 that were to populate AregNo and coastGuardNumber respectively, are not populating them.
Could it be in this method?
YEAR - FOUND IT!!
I had AregNo and coastGuardNumber twice, one empty and the other not.
NOW, when I enter values for Repeater1, they appear in Repeater2, YEAAA.
The real which I am about to try now is when I submit the data and try to populate the form with the account number, will the data I submitted load?
If you haven't set the default values for the columns, then the value will be null. Calling .ToString() on a null value will throw a NullReferenceException. Either set the default values for the columns, or use Convert.ToString(row.ItemArray).
As far as I can see, "TempData" was only ever set to the first table; in which case, you can replace it with:
Unless, I am not debugging this correctly, when I tried debugging, it keeps breaking on Repeater1 but shows boatYrBuilt as the culprit even though it is likely to not be the issue.
In other words, I enter account number, click enter and it loads page 1 which has personal info like name, phone, address, etc.
Then as soon as I click Next (to go to page2 which is Repeater1), it throws the incorrect format string error.
Could it be these?
<ItemTemplate><tr><td><asp:TextBoxID="txtboatregNum"Text='<%# Eval("MarineRegNo") %>'runat="server"placeholder="Enter registration #..."Style="width: 450px;"class="form-control"></asp:TextBox></td><td><asp:TextBoxID="txtPayerret"Text='<%# Eval("TaxPyrRetdVal") %>'runat="server"placeholder="Enter Taxpayer returned value as of Jan. 1..."Style="width: 400px;"class="form-control txtPayerret"></asp:TextBox></td></tr><tr><td><asp:TextBoxID="cgaurdNumber"Text='<%# Eval("VesselRegNo") %>'runat="server"placeholder="Enter Coast Guard #..."Style="width: 450px;"class="form-control"></asp:TextBox></td><td><asp:TextBoxID="cguardreturnedval"Text='<%# Eval("VesselTaxPyrRetdVal") %>'runat="server"placeholder="Enter Taxpayer returned value as of Jan. 1..."Style="width: 400px;"class="form-control txtPayerret"></asp:TextBox></td><td><asp:ButtonID="BtnAdd"Style="width: 150px;"runat="server"Text="Next Boat"OnClick="BtnAdd_Click"CssClass="btnclass"/><asp:ButtonID="btnDelete"Style="width: 120px;"runat="server"Text="Remove a row"OnClick="btnDelete_Click"CommandArgument='<%# Container.ItemIndex %>'CssClass="btnclass"/></td></tr></ItemTemplate>
I know you have been very patient with me and you have given me more than I asked for (Thank you) but can you please look at the below code for me?
The problem I believe, is that when I enter an account number, it is not populating the form.
Could you please see if there is something to change with the code below?
TER PROCEDURE [dbo].[sp_AllRecs]
SET NOCOUNT ON;
SELECT ROW_Number() OVER (ORDER BY(SELECT 0)) RowNumber, mp.[DateSold] as datesold
,mp.[SalePrice] as salePrice
,mp.[Description] as Description
,mp.[BuyerFullName] as buyername
,mp.[BuyerAddress] as buyeraddress
,mp.[BuyerCity] as buyercity
,mp.[BuyerState] as buyerstate
,mp.[BuyerZipCode] as buyerzip
,mp.[mDateSold] as mdatesold
,mp.[mSalePrice] as msalePrice
,mp.[mDescription] as mDescription
,mp.[mBuyerFullName] as mbuyername
,mp.[mBuyerAddress] as mbuyeraddress
,mp.[mBuyerCity] as mbuyercity
,mp.[mBuyerState] as mbuyerstate
,mp.[mBuyerZipCode] as mbuyerzip
,mp.[PreviousOwnerName] as PrevOnwerName
,mp.[PreviousOwnerAddress] as prevAddr
,mp.[PreviousOwnerCity] as prevCity
,mp.[PreviousOwnerState] as PrevState
,mp.[PreviousOwnerZipCode] as prevzip
,mp.[mPreviousOwnerName] as mprevOnwerName
,mp.[mPreviousOwnerAddress] as mprevAddr
,mp.[mPreviousOwnerCity] as mprevCity
,mp.[mPreviousOwnerState] as mPrevState
,mp.[mPreviousOwnerZipCode] as mprevzip
,ms.County As boatcnty
,ms.Registration_No As aRegNo
,ms.Motor_MFG_Make AS aMake
,ms.Boat_MFG_Make as mMake
,ms.Motor_MFG_Model as ModelNoA
,ms.Boat_MFG_Model as ModelNoM
,ms.Boat_Year_Built as boatYrBuilt
,ms.Motor_Year_Built as motorYrBuilt
,ms.[Length] as blength
,ms.HullMaterial as hullmaterial
,ms.HorsePower as mhorsepower
,ISNULL(ms.HorsePowerType,'NA') as rdlmhorsepType
,ms.Boat_DatePurchased as datePurchased
,ms.Motor_DatePurchased as mdatePurchased
,ISNULL(ms.Boat_PurchaseType,'NA') as PurchaseType
,ms.Motor_PurchaseType as rblmPurchasedType
,ms.MotorCost as motorCost
,ms.BoatCost as boatCost
,ms.boatIssues as rblIssues
,ms.motorIssues as mrblIssues
,ms.boatIssuesDetails as functionalIsses
,ms.motorIssuesDetails as mfunctionalIsses
,mf.TypeOfVessel as vesseltypeUse
,mf.VesselName as vesselname
,mf.HorspwrTypOfEngine as vesselhorsepEngine
,mf.CoastGuardNo AS coastGuardNumber
,mf.YearPurchased as VesselYrPurchased
,mf.PurchaseType as PurchasedNew
,mf.AmtOfPurchase as VesselPurchaseAmt
,mf.HomePort as homePort
,mf.WhereDocked as whereDocked
,mf.Boat_Motor_Accsry_Equip as bmequipAccessoryList
,mf.vesselLength as vessellength
,mf.YrVesselBuilt as vesselYrBult
,mf.VHullMaterial as VesselHullMateria
FROM MarineInfo m
INNER JOIN BoatMarincePurchaserInfo mp ON m.pid = mp.pid
INNER JOIN MarineScheduleD ms ON m.pid = ms.pid
INNER JOIN MarineFedVesselInfo mf ON m.pid = mf.pid
WHERE m.pid = @pin
privatevoid getRecs(int pin)
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("sp_AllRecs", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("@pin", pin);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dtPrevRecords = new DataTable();
if (dtPrevRecords.Rows.Count >0)
Repeater2.DataSource = dtPrevRecords;
ViewState["CurrentTable"] = dtPrevRecords;
pageLoad() eventif (!Page.IsPostBack)
Thanks for the quote buddy......... i think you miss something, the connection string i declared that was in Appconfig .... '
' and you doesn't even wanted to know where is my connection string for SQL.......?? but you commented on me. good. Please check the code properly.. And another thing please don't give the free Quote without judgement. Thanks
That's a hard-set connection string, not being pulled from AppConfig. The only part being set in appConfig is the machine path for the directory where the files are stored. You can set a connectionString in AppConfig all day and it literally doesn't matter if you don't use it.
Member 12863453 wrote:
OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
That's a class that uses the OLEDB provider to connect. That's meant for Office products, not SQL Server. It MIGHT work with SQL Server if the Client Tools Connectivity pack is installed on said server instance, but there's literally no point in using it when you have the native driver available (namely, SqlConnection).
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
Last Visit: 31-Dec-99 19:00 Last Update: 17-Jan-18 4:07