|
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
|
|
|
|
|
the ID column is an Auto-number..
?
|
|
|
|
|
you got WHERE ID='4' try WHERE ID=4
|
|
|
|
|
|
one of the fields name is wrong, Cap letter or something like that
MyDevBank.com
|
|
|
|
|
This should do the trick;
UPDATE news
SET subj='aasda22'
,[text]='sdasd'
WHERE id='4' "Text" should be avoided as a column-name; it's a reserved word.
I are Troll
|
|
|
|
|
mydevbank thank you
Eddy Vluggen!! thanks a lot brother, it worked. i never though of that lol!! TEXT is a reserved word. wth !! ive been dealing with this thing for a week and never though of changing columns names
thanks anyway for all
|
|
|
|
|
You're welcome
|
|
|
|
|
|
Deserve MVP
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Thanks
|
|
|
|
|
Hi all
info:
1) master page(mstr.master) has treeview control
2) aspx pages(detail.aspx and list.aspx) have mstr.master as their master
3) detail.aspx uses $.ajax.... to retrieve the content from detailcontent.aspx(which has no master)
Problem scenario :
(a) detail.aspx has finished loading, with the content from detailcontent.aspx
(b) I click a node in treeview which should load list.aspx(with mstr.master) but then the problem occurs.
(c) the problem is that the postback from the treeview is sent to detailcontent.aspx.
Any suggestions?
|
|
|
|
|
sigurdur einarsson wrote: detail.aspx uses $.ajax....
What do you mean by this?
sigurdur einarsson wrote: I click a node in treeview
Where is that treeview, in which page?
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
- $.ajax...
on document ready in detail.aspx I call jquery ajax function(http://api.jquery.com/jQuery.ajax) which retrieves content from detailcontent.aspx
- treeview
master page(mstr.master) has the treeview control, thus always visible
|
|
|
|
|
Could you please, send the event handler of node click
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Hi Mohammed Gouda
(have been working shifts last 3 days, got your email just now, thanks for the reaction)
- rendered node in html :
- these two functions(E_TreeNodePopulate,E_TreeNodeExpanded) handle it when the above node is clicked :
public void E_TreeNodePopulate(Object source, TreeNodeEventArgs e)
{
if (Session["SelectedNodeChanged"] == null)
{
int currentuserid=-1;
if (Session["userObj"] == null)
currentuserid = 0;
else
currentuserid = Convert.ToInt32(((UserObject)Session["userObj"]).Id);
foreach(TreeNode tn in e.Node.ChildNodes) //in the beginning the root should be e.Node
{
int treenodeuserid = TreeNodeHelper.getIdFromTreeNodeValue(tn.Value);
if (treenodeuserid == currentuserid)
{
Session["SelectedNodeChanged"] = tn;
Session["DisplayContactUserId"] = null;
}
}
}
populateSelectedNode(e.Node);
}
protected void E_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
populateCollectionPage(e.Node);
}
cheers, Siggi
|
|
|
|
|
I did not understand the reason behind calling these 2 events
If I were you, I would handle one event instead.
The best event for this scenario is the SelectedNodeChangedof the treeView, and it should be something like this
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
Response.Redirect("list.aspx");
}
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Hi ,
l am using jquery and jquery.corner pluging to create div rounded with border.
i get it, but my problem is that
i want to use drop shadow on bottom and right side of div . i am searching it last couple of days
but no getting it. i also have used liquid canvas but did not find correct solutions
Please suggest How to do it?
|
|
|
|