15,905,963 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by tina_overgaard (Top 113 by date)
tina_overgaard
3-Dec-15 6:38am
View
Is it SQL server on Visual studio or SQL studio manager?
tina_overgaard
30-Nov-15 8:16am
View
Thank you DotNetSteve for that explanation :-)
tina_overgaard
28-Nov-15 12:31pm
View
I am just following the link above, because I am an newbie. So what is my next step?
tina_overgaard
27-Nov-15 23:32pm
View
I have try that, it still comes with an error
tina_overgaard
27-Nov-15 8:21am
View
Yes really an newbie, just started in August. But I love coding :-). I have lidt issues with that example you gave me, how do I do this Children = CreateVM(m.CategoryId, source) there is an error on source because that is an list an the method is returning an IEnumerable??
tina_overgaard
27-Nov-15 8:00am
View
Yes really an newbie, just started in August. But I love coding :-). I have lidt issues with that example you gave me, how do I do this Children = CreateVM(m.CategoryId, source) there is an error on source because that is an list an the method is returning an IEnumerable??
tina_overgaard
27-Nov-15 6:06am
View
Thanks for the tip, I will try that :-)
tina_overgaard
6-Nov-15 2:10am
View
I Will look into these links. But in these links they have a fixed number of dropdowns, I do not know how many dropdowns I need maybee 5 or maybee more. Is that possible to make?
tina_overgaard
5-Nov-15 13:56pm
View
How to I load this partial view inside my ajax call?
tina_overgaard
5-Nov-15 10:58am
View
When I click on the first dropdown, I send the values to the CategoryList and return the json object again to the ajax succes call and inside where I add value to the dropdown I do it to a partial view?
tina_overgaard
5-Nov-15 9:51am
View
yes cascading dropdowns, then I load the partial view everytime I need an new dropdown menu??
tina_overgaard
3-Nov-15 4:36am
View
I have tried this one <input type="hidden" name="hid"+ @item.PhotoId++ value="@item.PhotoId" /> But it still gives me the wrong Id. If I take the last picture it will take the first pictures Id
tina_overgaard
1-Nov-15 15:50pm
View
I have tried this, but what is the @item.index?? I have tried to search on the internet for that soloution
tina_overgaard
1-Nov-15 15:24pm
View
I have tried this, but what is the @item.index?? I have tried to search on the internet for that soloution
tina_overgaard
23-Oct-15 6:03am
View
I have an foreach loop in my view that loops trough my pictures, and have three images on the view. When I select the the last or the middle it take the ID from the first photo
tina_overgaard
23-Oct-15 4:35am
View
I have hidden field with my photoId on the View, but cannot get it from the view to the controller
tina_overgaard
21-Oct-15 10:54am
View
Can you maybee show me how I do that?
tina_overgaard
21-Oct-15 7:41am
View
I dont know how to get the id from the picture I want to edit if I clicked on the input type="file"
tina_overgaard
9-Oct-14 16:54pm
View
This help me, thanks a lot for the quick repley :-)
tina_overgaard
9-Mar-14 11:34am
View
I know that each other is a girls name
tina_overgaard
4-Nov-13 16:39pm
View
Show the dialog code href="#contactFormContainer" id="showdialog2"
tina_overgaard
4-Nov-13 16:37pm
View
Hi
I have listed some things from a database in a datalist with a link tag. Look like this on front page.
ID= 21 something click me
<asp:DataList ID="VisDeli" runat="server" RepeatLayout="Table"
RepeatColumns="3" DataSourceID="SqlDataSource1" OnItemDataBound="VisDeli_ItemDataBound" CellSpacing="3" >
<HeaderTemplate>
<p class="overskrift_bestil">Ekstra varer</p>
</HeaderTemplate>
<itemtemplate>
<td><asp:TextBox ID="TextBox_deli" runat="server" Width="15" Height="15"></td>
<td><p><%#Eval("deli_navn") %></p></td>
<td>
Show the Dialog
</td>
When I click the click me link I want the popup box to show all the information on the product on ID=21. I know that I have to load some querystring when I click the html link, but I am stuck. This is what I have now:
<script type="text/javascript">
$(document).ready(function () {
$('#contactFormContainer').hide();
$('#showdialog2').click(function () {
$("#contactFormContainer").load("bekraeft.aspx?deli_id=deli_id");
$("#contactFormContainer").fadeToggle('slow');
});
});
</script>
tina_overgaard
4-Nov-13 13:08pm
View
When I click the button I want to show this information en the dialogbox.
Here is the list from the database with the button to open dialogbox:
<asp:DataList ID="VisDeli" runat="server" OnItemDataBound="VisDeli_ItemDataBound">
<HeaderTemplate>
</th>
<tr>
<th colspan="2"></th>
</tr>
</HeaderTemplate>
<itemtemplate>
<tr>
<td class="height"><asp:TextBox ID="TextBox_deli" runat="server" Width="15" Height="15"></td>
<td><p><%#Eval("deli_navn") %></p></td>
<td>
<asp:Button ID="btnPopup" runat="server" Text="Show Popup" />
</td>
</tr>
And this is the dialog box info that I want to show:
<div id="dialog" title="hejsa" >
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [delikatesse] WHERE ([deli_id] = @deli_id)">
<SelectParameters>
<asp:QueryStringParameter Name="deli_id" QueryStringField="deli_id" Type="Int32" />
</SelectParameters>
<asp:Repeater ID="Repeater3" runat="server" DataSourceID="SqlDataSource2">
<itemtemplate>
<div class="tekst_info">
<p><%#Eval("deli_navn") %> <br />
<%#Eval("tekst") %></p>
</div>
<div class="tekst_pris">
<p> <%#Eval("ml") %>, <%#Eval("pris") %> kr.</p>
</div>
<div class="billede_info">
<img src="Images/upload/Thumbs/<%#Eval("billede") %>" onerror="this. önerror=null;this.src='Images/upload/Thumbs/no_image.jpg'">
</div>
</div>
tina_overgaard
4-Nov-13 12:42pm
View
href="delikatesse.aspx?=deli_id<%#Eval("deli_id") %>
tina_overgaard
4-Nov-13 12:40pm
View
Now I understand and know that the popup box is a no go. So I choose the dialog box.
And when you click a button it will show. But how do I fetch the ID from the datbase from the button?
I have this list from the database, where I eval the things in a datalist and when I click the button I will show the infomation in the dialog box.
Something like this I will use with a normal HTML link?
">info
But how do I do the same with a button?
tina_overgaard
4-Nov-13 10:32am
View
I thought i ask my question corect. I know about popups, but the customer wants it. I dont know anything about jQuery "modal pop-ups" or "dialog" is to avoid it. Thats why I need some help to figure it out
tina_overgaard
4-Nov-13 9:53am
View
To get the popup box to show when click on linkButton
tina_overgaard
30-Oct-13 10:59am
View
This is your way:
INSERT INTO ordre_linie (fk_ordre_id, navn, fk_kurve_id, antal, total_pris, fk_dag_id)
SELECT * FROM dage, dag_navn, @fk_ordre, @navn, @kurv, @antal, @pris, @dag, @dag_navn
INNER JOIN dage ON ordre_linie.fk_dag_id = dage.dag_id
"
And I get this error:
Must declare the table variable "@fk_ordre".
Must declare the table variable "@navn".
Must declare the table variable "@kurv".
Must declare the table variable "@Antal".
Must declare the table variable "@pris".
Must declare the table variable "@dag".
Must declare the table variable "@dag_navn".
tina_overgaard
30-Oct-13 10:58am
View
I have done in you way, but I need the values
tina_overgaard
30-Oct-13 10:49am
View
Now it is the values
Incorrect syntax near the keyword 'VALUES'.
tina_overgaard
30-Oct-13 10:45am
View
INSERT INTO ordre_linie
(SELECT * FROM dage, fk_ordre_id, navn, fk_kurve_id, antal, total_pris, fk_dag_id, dag_navn)
INNER JOIN dage ON ordre_linie.fk_dag_id = dage.dag_id
VALUES (@fk_ordre, @navn, @kurv, @antal, @pris, @dag, @dag_navn)
It comes and say
Incorrect syntax near the keyword 'SELECT'.
Incorrect syntax near ')'.
tina_overgaard
30-Oct-13 10:30am
View
Can I do this??
INSERT INTO Table1 (Field1, Field2)
SELECT TableA.Field2, @parameter, @somevalue, @whateveryouneed.
FROM TableA
INNER JOIN TableA ON table1.id = TableA.ID
tina_overgaard
30-Oct-13 10:15am
View
This is how my email is look when it send to me:
Ordre nr Antal Navn
609 14 Blommer
609 7 Blomkål
Total pris på ordre 149 kr.
Leveringsdag 1 ????????????????????????? This one I want to show Monday from the table dag_navn
TinaOvergaard
Damgårdsvej 4
2100Kbh
2568965
tina_overgaard
30-Oct-13 10:00am
View
I am insert values in my table ordre_linie and send the information to my email.
But in my email there is stand 1 on fk_dag_id and I want to show what 1 stand for in the table dage.
ordre_linie table
fk_dag_id = 1
dage table
dag_id = 1
dag_navn = Monday
dag_id = 2
dag_navn = Thursday
tina_overgaard
30-Oct-13 9:59am
View
I am insert values in my table ordre_linie and send the information to my email.
But in my email there is stand 1 on fk_dag_id and I want to show what 1 stand for in the table dage.
ordre_linie table
fk_dag_id = 1
dage table
dag_id = 1
dag_navn = Monday
dag_id = 2
dag_navn = Thursday
tina_overgaard
30-Oct-13 9:23am
View
But I nees the values so it insert the values in the database
tina_overgaard
30-Oct-13 8:15am
View
CREATE TABLE [dbo].[ordre_linie] (
[ordre_linie_id] INT IDENTITY (1, 1) NOT NULL,
[antal] VARCHAR (50) NOT NULL,
[navn] VARCHAR (50) NOT NULL,
[fk_ordre_id] INT NOT NULL,
[fk_kurve_id] INT NOT NULL,
[total_pris] VARCHAR (50) NOT NULL,
[fk_dag_id] INT NOT NULL,
PRIMARY KEY CLUSTERED ([ordre_linie_id] ASC)
);
CREATE TABLE [dbo].[dage] (
[dag_id] INT IDENTITY (1, 1) NOT NULL,
[dag_navn] VARCHAR (50) NOT NULL,
PRIMARY KEY CLUSTERED ([dag_id] ASC)
);
tina_overgaard
30-Oct-13 8:12am
View
When I send email I just send the value 1 instead of Monday
tina_overgaard
30-Oct-13 8:11am
View
I have not learn to use stored procedures
tina_overgaard
30-Oct-13 8:11am
View
I have updated my question
tina_overgaard
27-Oct-13 17:11pm
View
I got it to work
tina_overgaard
27-Oct-13 15:53pm
View
int prisVare = How do I get the price from the database here?
So if I choose 2pcs of Nuts with ID 1 and presse the button it will 2 * price of nuts with ID 1
tina_overgaard
27-Oct-13 15:40pm
View
I need to get the price from the database
tina_overgaard
23-Oct-13 10:08am
View
I need to send the information from my database ordre_linie to my email
tina_overgaard
23-Oct-13 8:25am
View
foreach (MailAttachment ma in attachments)
{
mail.Attachments.Add(ma.File);
}
tina_overgaard
23-Oct-13 8:24am
View
Do I set my variabel from my database here
cmd.Parameters.Add("@name", SqlDbType;??
tina_overgaard
23-Oct-13 4:07am
View
I solved the problem
tina_overgaard
23-Oct-13 4:06am
View
I solved the problem with the solution 1
tina_overgaard
20-Oct-13 7:23am
View
Sorry for that, but I am á newbie to codeing. So this is the reason why I write so much, because I need som guidence. And trust me before I write I have sit with the code for hours before I have written on this forum. And sometimesit is probaly á dumb question for you guys, but to be better I need to ask and I actually learn something about it
tina_overgaard
19-Oct-13 14:59pm
View
List<valgtfrugt> valgteFrugter = (List<valgtfrugt>)Session["ValgteFrugter"];
I sat the breakpoint in this line:
var dataTable = new DataTable(Session["ValgteFrugter"].ToString());
And the error came immediately:
Object reference not set to an instance of an object.
tina_overgaard
19-Oct-13 14:41pm
View
I already have the make this list, so it could not be there?
tina_overgaard
19-Oct-13 14:40pm
View
I get the information correctly.
But it could just get the information from the session am I right?
Maybee like this or:
var dataTable = new DataTable(Session["ValgteFrugter"].ToString());
dataTable.Columns.Add("ID", typeof(int));
dataTable.Columns.Add("Navn", typeof(string));
dataTable.Columns.Add("Antal", typeof(int));
dataTable.Columns.Add("Vaerdi", typeof(int));
foreach (DataTable frugt in Session["ValgteFrugter"].ToString())
{
dataTable.Rows.Add(frugt.ID, frugt.Navn, frugt.Antal, frugt.Vaerdi);
}
tina_overgaard
19-Oct-13 13:44pm
View
But were could it be??
There is coming a red line underneath when I put in the code near the list I already have
tina_overgaard
19-Oct-13 13:16pm
View
Thanks
tina_overgaard
18-Oct-13 15:29pm
View
Thank you very much for your help
tina_overgaard
18-Oct-13 11:52am
View
Can I use neasted repeater or just two repeaters?
Can i write when i try this?
tina_overgaard
18-Oct-13 11:48am
View
Can I do something in the sql statement? I am really blank on this one. I have made the code when you insert something in the textbox you Will be going to the next page where there stand how much you have orderd and then you insert name and adress.
tina_overgaard
18-Oct-13 11:45am
View
I dont know how i solved this one
tina_overgaard
18-Oct-13 11:09am
View
I want to use the repeater that I know.
I have to get this SELECT * FROM frugt and SELECT * FROM groent inside the same repeater is that possible? I really hope so or else I have a problem
tina_overgaard
18-Oct-13 9:53am
View
I have tried this one:
SELECT '0' AS groent_id, frugt_id AS frugt_id, '0' as groent_navn, frugt_navn AS frugt_navn, vaerdi AS vaerdi, '0' AS groent_navn FROM frugt
UNION
SELECT groent_id AS groent_id, '0' AS frugt_id, groent_navn AS groent_navn, '0' AS frugt_navn, '0' AS vaerdi, groent_vaerdi AS groent_navn FROM groent
But then I get empty things where the rows is 0, Dont know if I can hide them or something
tina_overgaard
18-Oct-13 9:52am
View
It is a repeater with to tables. The one is fruits and the another one is vegetables.
You can only choose 14 fruits and only 7 vegetables. Therefor I need both textbox to get the user information in a session to another page
tina_overgaard
18-Oct-13 7:35am
View
I cannot use the datatable??
tina_overgaard
18-Oct-13 5:27am
View
I will do that
tina_overgaard
16-Oct-13 14:12pm
View
Stored Procedure have I never do before.
tina_overgaard
16-Oct-13 13:34pm
View
I have absolutely no clue what to do
tina_overgaard
16-Oct-13 13:32pm
View
Can you maybe explain it a little bit more??
tina_overgaard
16-Oct-13 13:06pm
View
What different datasource? DataList??
tina_overgaard
16-Oct-13 11:15am
View
Thank you that worked
tina_overgaard
16-Oct-13 4:44am
View
I have edited the mismatch, but it still not getting the session values to the datatable
tina_overgaard
16-Oct-13 4:32am
View
Cannot insert the value NULL into column 'fk_deli_id', table 'C:\USERS\TINAW\DESKTOP\SNUP1FRUGTWEB\APP_DATA\DATABASE.MDF.dbo.ordre_linie'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Line 212:
Line 213:
Line 214: cmd.ExecuteNonQuery();
Line 215: }
Line 216:
tina_overgaard
16-Oct-13 3:38am
View
I solved the wrong input string. But my datatable is empty, I Can figure out what I am doping wrong
tina_overgaard
15-Oct-13 14:57pm
View
Something is wrong with my datatable it is not returning the value from the sessions, so the datatable is empty
tina_overgaard
15-Oct-13 14:35pm
View
List<valgtfrugt> valgteFrugter = (List<valgtfrugt>)Session["ValgteFrugter"];
var dataTable = new DataTable();
dataTable.Columns.Add("FrugtID", typeof(int));
dataTable.Columns.Add("FrugtNavn", typeof(string));
dataTable.Columns.Add("Antal", typeof(int));
dataTable.Columns.Add("FrugtVaerdi", typeof(int));
foreach (ValgtFrugt frugt in valgteFrugter)
{
dataTable.Rows.Add(frugt.FrugtID, frugt.FrugtNavn, frugt.Antal, frugt.FrugtVaerdi);
}
List<valgtgroent> valgteGroent = (List<valgtgroent>)Session["ValgteGroent"];
var dataTable1 = new DataTable();
dataTable1.Columns.Add("GroentID", typeof(int));
dataTable1.Columns.Add("GroentNavn", typeof(string));
dataTable1.Columns.Add("AntalGroent", typeof(int));
dataTable1.Columns.Add("FrugtVaerdi", typeof(int));
foreach (ValgtGroent groent in valgteGroent)
{
dataTable1.Rows.Add(groent.GroentID, groent.GroentNavn, groent.AntalGroent, groent.GroentVaerdi);
}
List<valgtdeli> valgteDeli = (List<valgtdeli>)Session["ValgteDeli"];
var dataTable2 = new DataTable();
dataTable2.Columns.Add("DeliID", typeof(int));
dataTable2.Columns.Add("DeliNavn", typeof(string));
dataTable2.Columns.Add("Antal", typeof(int));
foreach (ValgtDeli delikatesse in valgteDeli)
{
dataTable1.Rows.Add(delikatesse.DeliID, delikatesse.DeliNavn, delikatesse.Antal);
}
DataTable dtAll = new DataTable();
dtAll = dataTable.Copy();
dtAll.Merge(dataTable1, true);
dtAll.Merge(dataTable2, true);
conn.Open();
foreach (DataRow row in dtAll.Rows)
{
cmd.CommandText = @"INSERT INTO ordre_linie
(fk_ordre_id, fk_frugt_id, fk_deli_id, fk_groent_id, antal)
VALUES (@fk_ordre, @fk_frugt_id, @fk_deli_id, @fk_groent_id, @Antal)";
cmd.Parameters["@fk_frugt_id"].Value = row["FrugtNavn"].ToString();
cmd.Parameters["@fk_deli_id"].Value = row["DeliNavn"].ToString();
cmd.Parameters["@fk_groent_id"].Value = row["GroentNavn"].ToString();
cmd.Parameters["@Antal"].Value = row["Antal"].ToString();
cmd.ExecuteNonQuery();
}
conn.Close();
Session.Abandon();
Response.Redirect("tak.aspx");
tina_overgaard
15-Oct-13 14:35pm
View
I have tested my project, and it looks like its been done correct. But when the Debugging is going to where the order is put in to the database it is coming with this error
Input string was not in a correct format.
Line 210:
Line 211:
Line 212: cmd.ExecuteNonQuery();
Line 213: }
Where is the wrong input string?
tina_overgaard
15-Oct-13 13:10pm
View
DataTable dt = (DataTable)Session["ValgteFrugter"];
DataTable dt1 = (DataTable)Session["ValgteGroent"];
DataTable dt2 = (DataTable)Session["ValgteDeli"];
DataTable dtAll = new DataTable();
dtAll = dt.Copy();
dtAll.Merge(dt1, true);
dtAll.Merge(dt2, true);
Like this?
tina_overgaard
15-Oct-13 9:56am
View
How do I get all the datatable merge to one? I need a little more help
tina_overgaard
15-Oct-13 9:47am
View
Is it something like this:
var FrugtList = new List<valgtfrugt>();
var dataTable = new DataTable();
dataTable.Columns.Add("FrugtID", typeof(int));
dataTable.Columns.Add("FrugtNavn", typeof(string));
dataTable.Columns.Add("Antal", typeof(int));
dataTable.Columns.Add("FrugtVaerdi", typeof(int));
foreach (var FrugtList in ValgtFrugt)
{
dataTable.Rows.Add(ValgtFrugt.FrugtID, ValgtFrugt.FrugtNavn, ValgtFrugt.Antal, ValgtFrugt.FrugtVaerdi)
}
tina_overgaard
15-Oct-13 9:06am
View
How do I get the cast to a datatable? Or can I use the genericList to get the session information into database?
tina_overgaard
14-Oct-13 15:25pm
View
I got it with use of inner join
tina_overgaard
14-Oct-13 15:25pm
View
Is there a SQL Server subject? Then I am very sorry, that I have put it in the wrong subject
tina_overgaard
14-Oct-13 11:22am
View
Now it is mixed together, could I unmixed it.
Now it is like this:
frugt
groent
frugt
groent
And I want to do this:
frugt
frugt
frugt
groent
groent
groent
tina_overgaard
14-Oct-13 10:56am
View
Yes
tina_overgaard
14-Oct-13 10:44am
View
My table could not be Inner join
CREATE TABLE [dbo].[groent] (
[groent_id] INT IDENTITY (1, 1) NOT NULL,
[groent_navn] NVARCHAR (50) NOT NULL,
[groent_vaerdi] NVARCHAR (50) NOT NULL,
PRIMARY KEY CLUSTERED ([groent_id] ASC)
);
CREATE TABLE [dbo].[frugt] (
[frugt_id] INT IDENTITY (1, 1) NOT NULL,
[frugt_navn] NVARCHAR (50) NOT NULL,
[vaerdi] NVARCHAR (50) NOT NULL,
PRIMARY KEY CLUSTERED ([frugt_id] ASC)
);
tina_overgaard
10-Oct-13 10:22am
View
Thank you very much!!!!! I inserted this one
if (Textbox_antal != null)
{
if(string.IsNullOrEmpty(Textbox_antal.Text))
{
Textbox_antal.Text = "0";
}
}
tina_overgaard
10-Oct-13 9:14am
View
Could you please show me what you mean?
tina_overgaard
10-Oct-13 9:10am
View
When I look on Default.aspx page there is no any values
<tr>
<td>Banan</td>
<td><input name="Repeater1$ctl100$txtbox1" type="text" id="Repeater1_txtbox1_0"></td>
<input type="hidden= name="Repeater1$ctl100$HiddenField1" id="Repeater1_HiddenField1_0">
</tr>
tina_overgaard
10-Oct-13 9:10am
View
It comes with this error now.
Input string was not in a correct format.
Line 81: int enkeltFrugtAntal = int.Parse(Textbox_antal.Text);
tina_overgaard
10-Oct-13 9:04am
View
When I look on Default.aspx page there is no any values
<tr>
<td>Banan</td>
<td><input name="Repeater1$ctl100$txtbox1" type="text" id="Repeater1_txtbox1_0"></td>
<input type="hidden= name="Repeater1$ctl100$HiddenField1" id="Repeater1_HiddenField1_0">
</tr>
tina_overgaard
10-Oct-13 9:03am
View
It comes with this error now.
Input string was not in a correct format.
Line 81: int enkeltFrugtAntal = int.Parse(Textbox_antal.Text);
tina_overgaard
10-Oct-13 8:24am
View
This is the one <asp:TextBox ID="txtbox1" runat="server" Width="30">
Its in a repeater
tina_overgaard
8-Oct-13 14:46pm
View
Deleted
Could I do something like this???
protected void Button1_Click1(object sender, EventArgs e)
{
foreach (RepeaterItem item in Repeater1.Items)
{
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
TextBox Textbox_antal = item.FindControl("txtbox1") as TextBox;
// opret forbindelsen til databasen
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
// opret et SqlCommand object
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
//Sql sætningen
cmd.CommandText = "INSERT INTO frugt (frugt_navn) VALUES(@frugt)";
cmd.Parameters.Add("@frugt", SqlDbType.VarChar).Value = Session["frugt"];
if (Textbox_antal != null)
{
if (string.IsNullOrEmpty(Textbox_antal.Text))
{
Textbox_antal.Text = "0";
}
}
Value = Convert.ToInt32(Value + int.Parse(Textbox_antal.Text));
Session["frugt_antal"] = Value;
if (Value != 7)
{
Label1.Text = "Der er 7 nu";
Panel_visfrugt.Visible = false;
Panel_vis.Visible = true;
}
else if (Value > 7)
{
Label1.Text = "Det er kun muligt at bestille 7 stk frugt";
}
}
}
Label_vis.Text = Convert.ToString(Session["frugt"]);
Label_vis.Text = Convert.ToString(Session["frugt_antal"]);
}
tina_overgaard
8-Oct-13 10:56am
View
But the code I have right now, is only giving me the calculated number the user give in all textbox.
Can you give me an exsample on how to give me the information like this:
2 apple
2 peach and so on?
and how do I control that they only can order 7 peace off fruits
tina_overgaard
8-Oct-13 10:41am
View
Deleted
When I am going to the Panel_vis I want to show wich fruit and how many fruit the user have order
tina_overgaard
8-Oct-13 8:10am
View
You did not make the answer as a solution I can accept
tina_overgaard
8-Oct-13 7:42am
View
Thank you very much
tina_overgaard
8-Oct-13 7:33am
View
It make sense. But how do I set the Textbox_antal to be 0 when nothing is insert in the textbox
tina_overgaard
8-Oct-13 7:26am
View
There is no value getting inside the session
tina_overgaard
8-Oct-13 3:51am
View
Thank you
tina_overgaard
6-Oct-13 7:58am
View
I have updated my question
tina_overgaard
28-May-13 11:05am
View
It comes from my TextBox ID, from my contact formular on frontpage
tina_overgaard
28-May-13 9:09am
View
var fromAddress = "myEmail"; here I have my gmail
var toAddress = TextBox_navn.Text.ToString(); How do I insert my email in here??
const string fromPassword = "password"; here i have my password
tina_overgaard
28-May-13 8:41am
View
It is not working, when I click the send button it comes with an error
tina_overgaard
1-May-13 5:01am
View
I have fixed the issues on the fields.
Now I have problem with this one string mUserDato = "01/05-2013";
Because its not a varchar but a datetime, the error his this:
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
The statement has been terminated.
I have try to do this:
int mUserDato = "01/05-2013"; But that does not work at all
tina_overgaard
1-May-13 2:27am
View
The function when you click the button
protected void Button_kommentar_Click(object sender, EventArgs e)
{
int mParentId = kommentar_ID;
int mArticleId = indlaeg_ID;
string mUserName = "quartz";
string mUserDato = "quartz@msn.com";
string mDescription = "Test Description";
int mIndent = myindent;
if (Page.IsValid)
{
mUserName = TextBox_navn.Text;
mUserDato = TextBox_dato.Text;
mDescription = TextBox_kommentar.Text;
Label_kommentar.Text = "Korrekt";
Label_kommentar.ForeColor = System.Drawing.Color.Green;
SqlConnection conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO kommentar (dato, navn, kommentar, fk_indlaeg_ID) VALUES(@dato, @navn, @kommentar, @indlaeg)";
cmd.Parameters.Add("@dato", SqlDbType.DateTime).Value = TextBox_dato.Text;
cmd.Parameters.Add("@navn", SqlDbType.VarChar).Value = TextBox_navn.Text;
cmd.Parameters.Add("@kommentar", SqlDbType.Text).Value = TextBox_kommentar.Text;
cmd.Parameters.Add("@indlaeg", SqlDbType.Int).Value = Request.QueryString["indlaeg_ID"];
cmd.CommandText = "INSERT INTO kommentar (dato, navn, kommentar, fk_indlaeg_ID) VALUES('" +mParentId + "','" + mArticleId + "','" + mUserName + "','" + mUserDato + "','" + mDescription + "','" + "')";
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
TextBox_dato.Text = "";
TextBox_navn.Text = "";
TextBox_kommentar.Text = "";
Label_kommentar.Text = "Din kommentar er modtaget.";
}
else
{
Label_kommentar.Text = "Du skal indtaste Captcha eller du har indtastet forkert";
Label_kommentar.ForeColor = System.Drawing.Color.Red;
}
}
The database for article is:
CREATE TABLE [dbo].[indlaeg] (
[indlaeg_ID] INT IDENTITY (1, 1) NOT NULL,
[fk_katogori_ID] INT NOT NULL,
[overskrift] VARCHAR (50) NOT NULL,
[navn] VARCHAR (50) NOT NULL,
[tekst] TEXT NOT NULL,
[dato_indlaeg] DATETIME NOT NULL,
[billede] TEXT NULL,
CONSTRAINT [PK_indlaeg_indlaeg_ID] PRIMARY KEY CLUSTERED ([indlaeg_ID] ASC)
);
For the comment:
CREATE TABLE [dbo].[kommentar] (
[kommentar_ID] INT IDENTITY (1, 1) NOT NULL,
[fk_indlaeg_ID] INT NOT NULL,
[dato] DATETIME NOT NULL,
[kommentar] TEXT NOT NULL,
[navn] VARCHAR (50) NOT NULL,
CONSTRAINT [PK_kommentar_kommentar_ID] PRIMARY KEY CLUSTERED ([kommentar_ID] ASC)
);
tina_overgaard
1-May-13 1:40am
View
What about SmtpMail.Send(objMM);
And do I need to have something in my web.config for smtp?
And I get a server error, when I try to Insert a comment, so something is wrong about my code in the insert.
Here is the error:
There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
Line 77:
Line 78: conn.Open();
Line 79: cmd.ExecuteNonQuery();
Line 80: conn.Close();
Line 81:
tina_overgaard
30-Apr-13 8:32am
View
Deleted
hr
tina_overgaard
30-Apr-13 6:49am
View
http://www.william-overgaard.dk/VisBlognyhed.aspx?indlaeg_ID=13
This is the website I want to have it on. The codebeind file for this site is
protected void Page_Load(object sender, EventArgs e)
{
recaptcha.Validate();
if (Request.QueryString["indlaeg_ID"] != null)
{
int q = Convert.ToInt32(Request.QueryString["indlaeg_ID"]);
//hentProdukt(q);
}
}
protected void Button_kommentar_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
Label_kommentar.Text = "Korrekt";
Label_kommentar.ForeColor = System.Drawing.Color.Green;
SqlConnection conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO kommentar (dato, navn, kommentar, fk_indlaeg_ID) VALUES(@dato, @navn, @kommentar, @indlaeg)";
cmd.Parameters.Add("@dato", SqlDbType.DateTime).Value = TextBox_dato.Text;
cmd.Parameters.Add("@navn", SqlDbType.VarChar).Value = TextBox_navn.Text;
cmd.Parameters.Add("@kommentar", SqlDbType.Text).Value = TextBox_kommentar.Text;
cmd.Parameters.Add("@indlaeg", SqlDbType.Int).Value = Request.QueryString["indlaeg_ID"];
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
TextBox_dato.Text = "";
TextBox_navn.Text = "";
TextBox_kommentar.Text = "";
Label_kommentar.Text = "Din kommentar er modtaget.";
}
else
{
Label_kommentar.Text = "Du skal indtaste Captcha eller du har indtastet forkert";
Label_kommentar.ForeColor = System.Drawing.Color.Red;
}
}
tina_overgaard
30-Apr-13 6:44am
View
But will it give me a clue off what particular post the comment is writing on?
tina_overgaard
30-Apr-13 6:30am
View
Thanks for the help, but I think I will find an easier solution
tina_overgaard
30-Apr-13 6:30am
View
Thanks for the help, but I think I will find an easier solution
tina_overgaard
23-Apr-13 16:12pm
View
Yes, I have search in here. I have actually try to search for a solution in a few month now, and can only find solution to use resx files.
But cannot find anything about when you have database content
tina_overgaard
23-Apr-13 10:37am
View
But how do I do that? I have never done something like this before
tina_overgaard
23-Apr-13 10:36am
View
I want to flags for each country and when I click the language is changing
Show More