|
textbox1 | textbox2 | textbox3 | button
in a simple flow:
when button click (
valid = true
validate textbox1
validate textbox2
validate textbox3
if(valid) insert else message("one of ......")
}
MyDevBank.com
|
|
|
|
|
MyDevBank wrote:
in a simple flow: ???
Both the repeater values to be inserted in single button click and it should be checked for each row of 2 repeaters this is my requirement.... this will not work by your explanation...
|
|
|
|
|
so i didnt got the right view of the UI you are describing
can you describe it better ?
MyDevBank.com
|
|
|
|
|
2 repeaters in page each repeater with 3 textboxs created dynamically and link button(Add more) to add inside repeater to add textboxs dynamically at the end of page submit button to insert the values to db.
suppose i click on addmore button to add three rows of textboxs and values enterd into it and finally when i click on submit button then it should check the condition for each of rows in repeater if its is true then page redirected to other else error message should display... this is same for both repeaters...
|
|
|
|
|
Hi,
I am new to RDLC, I have mapped my Dataset to RDLC. My RDLC Control have one table where I mapped all my columns of passing Dataset.
How the paging is coming based on my records, Can I change the page size (ie. show only 10 rows per page).
Thanks,
Rams.
Be simple and Be sample.
|
|
|
|
|
Hi,
I have designed one page with RDLC Control with table having links, onclick it will open the new page (using Jumpt to URL).
It opens new window fine for 1st page, when I move to 2 page using page navigator and click any link, then the link opens new page within the RDLC table area.
How to solve this?
Thanks in Advance,
Rams.
Be simple and Be sample.
|
|
|
|
|
hello guys,
i have an Access db. im uploading an image to my gallery table.
anyway. i need to insert some text in the field before adding the filename string
i need it to look this way at the db
Axxx.jpg
Azzz.jpg
Abbb.jpg
so i used the following code:
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string imagefolder = "photo";
string savepath;
string savefile;
Label3.Text = "A";
if (FileUpload1.HasFile)
{
savepath = Path.Combine(Request.PhysicalApplicationPath, imagefolder);
savefile = Path.Combine(savepath, FileUpload1.FileName);
FileUpload1.PostedFile.SaveAs(Server.MapPath(("" + this.Label3.Text +"" + System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName))));
AccessDataSource1.Insert();
}
}
but i still keep getting in the db only the file's name without the text i want to add before it.
any ideas?
thank you.
|
|
|
|
|
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string imagefolder = "photo";
string savepath;
string savefile;
Label3.Text = "prefix";
if (FileUpload1.HasFile)
{
string entryName = Label3.Text +
System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
savepath = Path.Combine(Request.PhysicalApplicationPath, imagefolder);
savefile = Path.Combine(savepath, FileUpload1.FileName);
FileUpload1.PostedFile.SaveAs(Server.MapPath(entryName));
AccessDataSource1.Insert();
}
} Can you put a breakpoint on the highlighted line and inspect the variable entryName and post it's value?
I are Troll
|
|
|
|
|
Hi Eddy thanks for ur replay
Maybe i should get me a NON-Express edition of visual studio
unfortunatly im using the express edition where i cant do that. if u think there is a way after all i'd love to know
thanks for ur help brother !
|
|
|
|
|
here i figured it out sorry!
anyway
the enteryname is
"prefixidd9e1uDBJ-preview.jpg"
as it should be, but at the database, its only the jpg name without the prefix
|
|
|
|
|
What's the SQL of the AccessDataSource1.InsertCommand ? Does it get the correct parameters?
I are Troll
|
|
|
|
|
<InsertParameters>
<asp:controlParameter Name="file" Type="String" ControlID="FileUpload1" PropertyName="FileName"/>
<asp:controlParameter Name="about" Type="String" ControlID="txtBoxAbout" PropertyName="text" />
</InsertParameters>
|
|
|
|
|
You got it working you said?
The "Accessdatasource1"-control should have a property called "InsertCommand". That property holds an INSERT statement, in Sql-syntax.
Since you said that the variables contain the correct value, I'm guessing that it must go wrong when writing to the database. That's the task of the Accessdatasource, hence we'd want to check that next
I are Troll
|
|
|
|
|
this is my insercommand
InsertCommand="INSERT INTO [gallery] ([file], [about]) VALUES (?, ?)"
and my insertparameters
<InsertParameters>
<asp:controlParameter Name="file" Type="String" ControlID="FileUpload1" PropertyName="FileName"/>
<asp:controlParameter Name="about" Type="String" ControlID="txtBoxAbout" PropertyName="text" />
</InsertParameters>
what do u think i should do or add?
thanks
|
|
|
|
|
|
How about pointing the parameter to that label?
<asp:controlParameter Name="about" Type="String" ControlID="txtBoxAbout" PropertyName="text" />
Now, when you click the button, update the label first;
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string imagefolder = "photo";
string savepath;
string savefile;
Label3.Text = "Bla" + System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName); Does that fix it?
I are Troll
|
|
|
|
|
it didnt work.
i also tried using the $ sign -
ControlID="Label3$FileUpload1"
and added
<asp:ControlParameter Name="pre" Type="string" ControlID="Label3" PropertyName="text" />
still not working. this is driving me crazy.
|
|
|
|
|
The idea was to point the parameter to the label; the Name should point to the parameter-name (that's "file", from your Sql statement), the ControlId should point to the control that you're binding the parameter to. The Label displays it's contents in a Text property, hence the binding;
<asp:ControlParameter ControlID="Label3" Name="file" PropertyName="Text" Type="String" /> Does the value of the label get set correctly?
I are Troll
|
|
|
|
|
Hi Eddy,
this didnt fix it.
Any other ideas?
|
|
|
|
|
don-basil wrote: this didnt fix it.
Any other ideas?
I'm out of idea's, maybe one of the ASP.NET guru's can help out
I are Troll
|
|
|
|
|
well, Eddy!
i thank you ALOTTT for your time and help. u are great.
if i ever get this solved i'll post it in here
thanks again
|
|
|
|
|
hello,
i have a Datalist and ACCESS DataBase, im using the update event in datalist to update two fields in my db.
first one is subj the second is text.
i get the Syntax error in update statement all the time while updating.
the primary key is my ID field in the db, and it was set to be the same in the datalist.
this is the C# code for the update method:
protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
{
Label lblsubj = (Label)e.Item.FindControl("lblsubj");
string st = lblid.Text;
TextBox txtBoxId = (TextBox)e.Item.FindControl("txtBoxId");
TextBox txtBoxTitle = (TextBox)e.Item.FindControl("txtBoxTitle");
TextBox txtBoxFile = (TextBox)e.Item.FindControl("txtBoxFile");
TextBox txtBoxText = (TextBox)e.Item.FindControl("txtBoxText");
string queryStr = "UPDATE news SET subj='" + txtBoxTitle.Text + "', ";
queryStr += "text='" + txtBoxText.Text + "', ";
queryStr += "WHERE id='" + st + "'";
string connectionStr = @"Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Server.MapPath("~/App_Data/db.mdb");
OleDbConnection connectObj = new OleDbConnection(connectionStr);
OleDbCommand cmd = new OleDbCommand(queryStr, connectObj);
connectObj.Open();
cmd.ExecuteNonQuery();
connectObj.Close();
this.DataList1.EditItemIndex = -1;
BindTheDataList();
}
And this is my ASPX page code:
<asp:DataList ID="DataList1" runat="server" DataKeyField="subj" Height="96px"
OnCancelCommand="DataList1_CancelCommand" OnDeleteCommand="DataList1_DeleteCommand"
OnEditCommand="DataList1_EditCommand" OnUpdateCommand="DataList1_UpdateCommand"
Style="position: static" Width="641px">
<EditItemStyle BackColor="DarkGray" ForeColor="Black" />
<EditItemTemplate>
<table id="TABLE1" language="javascript" onclick="return TABLE1_onclick()">
<tr>
<td style="width: 90px">
Editing item:
<asp:Label ID="lblid" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"id") %>'
Visible="False"></asp:Label></td>
</tr>
<tr>
<asp:Button ID="btnUPDATE" runat="server" BorderColor="Azure" CommandName="update"
Text="update" /><asp:Button ID="Button4" runat="server" BorderColor="Azure" CommandName="delete"
Text="delete" /><asp:Button ID="Button5" runat="server" BorderColor="Azure" CommandName="cancel"
Text="cancel" /></tr>
<tr>
</tr>
<tr>
<td style="width: 60px">
Id</td>
<td style="width: 520px">
<asp:TextBox ID="txtBoxId" runat="server" Enabled="False" Width="18px" Text='<%# DataBinder.Eval(Container.DataItem,"id") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 60px">
Title</td>
<td style="width: 520px">
<asp:TextBox ID="txtBoxTitle" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"subj") %>'
Width="319px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 60px; height: 133px;">
Text</td>
<td style="width: 520px; height: 133px;">
<asp:TextBox ID="txtBoxText" runat="server" Height="184px" Text='<%#DataBinder.Eval(Container.DataItem,"text")%>'
TextMode="MultiLine" Width="516px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 60px; height: 7px">
File</td>
<td style="width: 520px; height: 7px">
<asp:TextBox ID="txtBoxFile" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"file") %>'
Width="317px"></asp:TextBox></td>
</tr>
</table>
</EditItemTemplate>
<SelectedItemStyle Font-Size="Medium" />
<ItemTemplate>
<table style="width: 682px; height: 173px">
<tr>
<asp:LinkButton ID="Linkbutton1" runat="server" CommandName="edit" Font-Bold="true"
Font-Underline="false" ForeColor="gray" Text="Edit "></asp:LinkButton></tr>
<tr>
<td style="width: 9px;">
<strong>Id</strong></td>
<td style="width: 118px;">
<%#DataBinder.Eval(Container.DataItem,"id")%>
</td>
</tr>
<tr>
<td style="width: 9px;">
<strong>Title</strong></td>
<td style="width: 118px;">
<%#DataBinder.Eval(Container.DataItem,"subj")%>
</td>
</tr>
<tr>
<td style="width: 9px;">
<strong>Text</strong></td>
<td style="width: 118px;" id="TD1">
<%#DataBinder.Eval(Container.DataItem,"text")%>
</td>
</tr>
<tr>
<td style="width: 9px;">
<strong>File</strong></td>
<td style="width: 118px;">
<%#DataBinder.Eval(Container.DataItem,"file")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
the error i keep getting:
Exception Details: System.Data.OleDb.OleDbException: Syntax error in UPDATE statement.
Source Error:
Line 77: OleDbCommand cmd = new OleDbCommand(queryStr, connectObj);
Line 78: connectObj.Open();
Line 79: cmd.ExecuteNonQuery();
Line 80: connectObj.Close();
Line 81: this.DataList1.EditItemIndex = -1;
this is the string that i get while debuging for the update statement :
"UPDATE news SET subj='aasda22', text='sdasd', WHERE id='4'"
all i need to know WHAT IS WRONG in my UPDATE statement !!
thanks for ur help.
|
|
|
|
|
Member 4429208 wrote: "UPDATE news SET subj='aasda22', text='sdasd', WHERE id='4'"
Remove the comma before WHERE
Concatenate a statement like this
"UPDATE news SET subj='aasda22', text='sdasd' WHERE id='4'"
Hope this helps
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Thank you Mohammed, i've tried that too and it failed with a syntax error in update statement.
any other ideas?
thanks,
Basil
|
|
|
|
|
WHERE id='4' is your ID column type is a VAR/NVARcher type ?
MyDevBank.com
|
|
|
|