|
Hi
Your problem is more SQL related than ASP.NET related. I'd post this in the SQL forum. Also, don't build up SQL strings by concatonation. You are wide open to SQL Injection Attacks[^]
Small angry dogs
|
|
|
|
|
By default I have 10 rows of dynamically created controls on Page Load. After entering Data, When i click Submit button, only rows in which data entered should be inserted into the database.
I am inserting records based on the table rows count. So, it inserts 10 records even if values are not entered.
protected void btnSubmit_Click(object sender, EventArgs e)
{
int j = tblRunTime.Rows.Count;
for (int c = 0; c < j; c++)
{
string query = " INSERT INTO Time VALUES( ";
query = query + " '" + Request.Form["_dr1" + c.ToString()] + "', ";
query = query + " '" + Request.Form["_dr2" + c.ToString()] + "', ";
query = query + " '" + Request.Form["text1" + c.ToString()] + "', ";
...
query = query + " '" + Request.Form["text8" + c.ToString()] + "', ";
query = query + " '" + f_date_b.Value + "'";
query = query + " )";
}
So, how i can solve this?
Can anyone please help me?
Thanks & Regards,
Radha
|
|
|
|
|
In this, you are not checking the value is entered or not. And your controls are dynamically created on page_load, which don't have a viewstate maintained. So you won't get values for those controls. Consider creating it in some other event like (Init). Also read about SQL Injection attacks.
|
|
|
|
|
But, I can get values for those controls. If i enter Data for 2 rows and click Submit button, 2 rows will be inserted with the entered values and the remaining 8 rows will be inserted with null values. I dont want that 8 rows to be inserted.
Thanks & Regards,
Radha
|
|
|
|
|
Before insertion, check the controls has a value. If not sip it,
|
|
|
|
|
But, I can get values for those controls. If i enter Data for 2 rows and click Submit button, 2 rows will be inserted with the entered values and the remaining 8 rows will be inserted with null values. I dont want that 8 rows to be inserted. How can i do this?
Thanks & Regards,
Radha
|
|
|
|
|
hi,
Can anyone tell me how to bind a DataTable Column field to a DropDownList Items which is present in a GridView.
DataTable and GridView is generated at runtime.
A key to every Solution
|
|
|
|
|
You need to find DropDown from GridView in GridView's RowDataBound event and bind it.
|
|
|
|
|
Thanks,
Can I add it like Eval on Bind method as we do for label..
<asp:templatefield headertext="CUST_ID">
<headertemplate>CUST_ID
<itemtemplate>
<asp:label id="lblCustID" text="">]]>' runat="server">
I have the DropDownList instead of Label and CUST_ID is the Column anme present in the DataTable
A key to every Solution
|
|
|
|
|
Thanks,
Can I add it like Eval on Bind method as we do for label..
<asp:templatefield headertext="CUST_ID">
<headertemplate>CUST_ID
<itemtemplate>
<asp:label id="lblCustID" text="">]]>' runat="server">
I have the DropDownList instead of Label and "CUST_ID" is the Column name present in the DataTable
A key to every Solution
|
|
|
|
|
You can add the dropdownlist to the template column at runtime. then, In rowcreated event of Gridview, you can find the dropdownlist that you have added and bind the data.
|
|
|
|
|
hi,
thanks friend..
can u give a sample of code how to it...
A key to every Solution
|
|
|
|
|
Hi all,
Can I add Change the PageStyle Button like HTML Buttons in Datagrid using ASP.Net 1.0
Thanks
Dana
|
|
|
|
|
You can't add a HTML button there. Use CSS to style current pager links to look like a HTML button.
|
|
|
|
|
Thanks for the reply Navan,
Can I add the sylesheets in the desing view itself ?
Dana
|
|
|
|
|
Yes. Datagrid allows you to add a pager style tag.
|
|
|
|
|
Thanks.. I wll have a try
Dana
|
|
|
|
|
I tried like this .But it is not displaying any box arround the Next or previous buttons<br />
<br />
<br />
<br />
<PagerStyle NextPageText="Next" PrevPageText="Previous" Position="TopAndBottom" BorderStyle="Solid"<br />
BorderWidth="1" Mode=NextPrev ><br />
|
|
|
|
|
Pager links are just hyperlinks. So create a CSS class which can style the hyperlinks and assign that class to the pager style.
|
|
|
|
|
I tried this one...
But It applied the whole row...
color: #FFFFFF; text-decoration: none; text-transform: none; background:
#800000;
|
|
|
|
|
Hi there,
I created an installer which installs two msi files. This installer is working fine in Xp and 98. But it's giving error in Vista. The error is: Another Process is running. Is there any other way to rectify this problem? Please help..!!
Regards n Thks
Sam.M
modified on Monday, January 14, 2008 4:33:04 AM
|
|
|
|
|
Hi,
I've done research on this topic, but couldn't find much information.
Does CP have good articles on creating ASP.NET intaller packages using Visual Studio 2003 and VS 2005, with different options defined clearly, or other article on internet?
Do you normally user VS built in Deployment project or third party installer software?
Regards,
Blumen
|
|
|
|
|
|
N a v a n e e t h wrote: Which bit you are stuck ?
I had issues with adding custom functionalities. Normally when we install software, we can see Company image in the installer, custom validations, et al. I needed to know how to achieve these with VS installer. Also, adding reference dlls, like if I want the installer to intall Telerik dlls which my product would use.
|
|
|
|
|
Few days back I downloaded MOSS 2007 trial version to try creating custom workflow using InfoPath forms. But could not locate "InfoPath Forms Services" option under "Application Management" tab, and any other means to publish InfoPath forms in MOSS.
MOSS installation is pretty simple and I dont think I missed anything there. Does it means InfoPath Forms Service is not included in the latest MOSS 2007 trial version and I need to install Forms server 2007 also ?
Or I would greatly appreciate if any body could figure out the silly mistake I am doing here
|
|
|
|