|
Can we write text and upload image in the text editor type and save that data in html format ? Any idea if we need to put text plus image together??
suchita
|
|
|
|
|
Hi Suchita,
SayamiSuchi wrote: Can we write text and upload image in the text editor type and save that data in html format ? Any idea if we need to put text plus image together??
Your problem is not clear to me. Could you please explain it in details ?
I am bit confused in this statement,
SayamiSuchi wrote: Can we write text and upload image in the text editor type
And where do you want to save ?
|
|
|
|
|
Sorry for not stating my problem well. Actually I am wondering if we could do something like this.
Lets say I have a text editor and we can get the input data from the text editor. Now Is it possible someway that we can have text and image as a data in that text editor ? Also when we save, Can we save both text and image as a single data and save it ?
suchita
|
|
|
|
|
Which texteditor are you using ? Is it AJAX Text editor ?
|
|
|
|
|
no I am just using textbox setting multiline..
suchita
|
|
|
|
|
You can not do it in multiline textbox.
Consider FCK editor for the same.
You may need to do a bit of struggle to store both Text and Image in binary format.
|
|
|
|
|
thanks. I will try.
suchita
|
|
|
|
|
hello,
I have a table in database which is as below:
CREATE TABLE item(
id INT,
itemModel VARCHAR(100),
name VARCHAR(100),
description VARCHAR(100),
created VARCHAR(100),
creator VARCHAR(100),
then in my BusinessObject Layer I have this class:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.ComponentModel;
namespace WebApplication1.Repository.BusinessObject
{
public class Items
{
private int _id = -1;
private string _model = string.Empty;
private string _name = string.Empty;
private string _description = string.Empty;
private DateTime _created = DateTime.MinValue;
private string _ctreator = string.Empty;
[DataObjectFieldAttribute(true,true,false)]
public int ID
{
set { _id = value; }
get { return _id; }
}
public string Model
{
set { _model = value; }
get { return _model; }
}
public string Name
{
set { _name = value; }
get { return _name; }
}
public string Description
{
set { _description = value; }
get { return _description; }
}
public DateTime Created
{
set { _created = value; }
get { return _created; }
}
public string Creator
{
set { _ctreator = value; }
get { return _ctreator; }
}
public Items(int id, string model, string name, string description,
DateTime created, string ctreator)
{
this._id = id;
this._model = model;
this._name = name;
this._description = description;
this._created = created;
this._ctreator = Creator;
}
}
}
then I create another layer called DataAccess define this class
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using WebApplication1.Repository.BusinessObject;
using System.Data.Common;
using System.Data.SqlClient;
namespace WebApplication1.Repository.DataAccessLayer
{
public class ItemsDB
{
public static int Save(Items NewItems)
{
int Result = 0;
SqlConnection MyConnection = new SqlConnection(ConfigurationManager.
ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand MyCommand = new SqlCommand("SprocInsertUpdateSingleItem",
MyConnection);
MyCommand.CommandType = CommandType.StoredProcedure;
if (NewItems.ID == -1)
{
MyCommand.Parameters.AddWithValue("@id", DBNull.Value);
}
else
{
MyCommand.Parameters.AddWithValue("@id", NewItems.ID);
}
MyCommand.Parameters.AddWithValue("@ItemModel", NewItems.Model);
MyCommand.Parameters.AddWithValue("@Name", NewItems.Name);
MyCommand.Parameters.AddWithValue("@Description", NewItems.Description);
MyCommand.Parameters.AddWithValue("@Created", NewItems.Created);
MyCommand.Parameters.AddWithValue("@Creator", NewItems.Creator);
DbParameter returnValue;
returnValue = MyCommand.CreateParameter();
returnValue.Direction = ParameterDirection.ReturnValue;
MyCommand.Parameters.Add(returnValue);
MyConnection.Open();
MyCommand.ExecuteNonQuery();
Result = Convert.ToInt32(returnValue.Value);
MyConnection.Close();
return Result;
}
}
}
next, in BusinessLogicLayer I try to interact with database
using System;
using System.Collections.Generic;
using System.Web;
using System.ComponentModel;
using System.Transactions;
using WebApplication1.Repository.DataAccessLayer;
using WebApplication1.Repository.BusinessObject;
namespace WebApplication1.Repository.BusinessLayer
{
public class ItemsManager
{
[DataObjectMethod(DataObjectMethodType.Update,true)]
public static int Save(Items NewItem)
{
using (TransactionScope MyTransactioScope = new TransactionScope())
{
int ItemId = ItemsDB.Save(NewItem);
foreach ( Items itemId in NewItem.ID)
{
itemId.ID = ItemId;
ItemsDB.Save(itemId);
}
NewItem.ID = ItemId;
MyTransactioScope.Complete();
return ItemId;
}
}
}
}
after I run the program I get this error:
<br />
foreach statement cannot operate on variables of type 'int' because 'int' does not contain a public definition for 'GetEnumerator' <br />
Do you recken the problem is regarding database design?
I get this idea from the following link
http://www.wewill.cn/n2020c22.aspx
I really appreciate if someone help me in this matter.
is there anyway to put my project here?then people can see it and maybe help me.
|
|
|
|
|
foreach ( Items itemId in NewItem.ID)
{ ... }
2 things are wrong in this case.
1. You are trying to enumerate an integer (which does not implement IEnumerable and does not have to - more info about IEnumerable[^]) that belongs to NewItem object (Items class)
2. NewItem is an instance of Items and thus there is just 1 object. So you need not enmumerate but just replace
foreach ( Items itemId in NewItem.ID)
{
itemId.ID = ItemId;
ItemsDB.Save(itemId);
}
NewItem.ID = ItemId;
with
NewItem.ID = ItemsDB.Save(NewItem);
I didn't go through all of your code, but this will help solve your error.
Cheers,
Karthik
|
|
|
|
|
When developing web page for mobile, what's the standard width I should use?
|
|
|
|
|
There isn't a "standard" width... this[^] site is temporarily down ("scheduled maintenance", it says) but take a look when it's back up.
|
|
|
|
|
Hello All,
I'm using VS 2010 .In this, I have bound the DataSource in the Gridview.I have taken one Button in the HeaderTemplate in the columns in the GridView. Now, I want to add New DataRow with empty textboxes in gridview.
the code is as follows:
<asp:gridview id="grdUserDetails" runat="server" datakeynames="UserId" width="80%"
="" onrowcommand="grdUserDetails_RowCommand" onpageindexchanging="grdUserDetails_PageIndexChanging" onrowcancelingedit="grdUserDetails_RowCancelingEdit" onrowdeleting="grdUserDetails_RowDeleting" onrowediting="grdUserDetails_RowEditing" onrowupdating="grdUserDetails_RowUpdating">
<columns>
<asp:templatefield headertext="Action" itemstyle-width="10%" headerstyle-width="10%">
<headertemplate>
<asp:button id="btnAddNewRow" runat="server" text="Add New Row">;
<itemtemplate>
<asp:linkbutton id="btnEdit" runat="server" causesvalidation="false" commandname="Edit" text="Edit">
<asp:linkbutton id="btnDelete" onclientclick="return confirm('Are you sure you want to delete?');" runat="server" causesvalidation="false" commandname="Delete" text="Delete">
<edititemtemplate>
<asp:linkbutton id="btnUpdate" runat="server" commandname="Update" validationgroup="EditValidation" text="Update">
<asp:linkbutton id="btnCancel" runat="server" causesvalidation="false" commandname="Cancel" text="Cancel">
|
|
|
|
|
Review Code Project guidelines and format any code snippets you post. You will be mostly ignored until you do.
Yo have posted no question. What are you having difficulties with?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hello,
I read an article regarding DataObjectMethod. I can use it like Polymorphism. Just got question and it is what is the diference between
[DataObjectMethod(DataObjectMethodType.Select, false)]
and
[DataObjectMethod(DataObjectMethodType.Select, True)]
thanks
|
|
|
|
|
I don't know. However if I wanted to know, I would read the MSDN documentation, starting here[^].
|
|
|
|
|
Hi,
i have two usercontrols say usrcntrl1.ascx and usrcntrl2.ascx. In usrcntrl2, i have just few links defined. And I want this usrcntrl2 to show up in every page just like header. And now i have usrcntrl1 to call usrcntrl2 on the page_load. How to use nested usercontrols in this case? Is it possible ?
suchita
|
|
|
|
|
My problem is solved already..
suchita
|
|
|
|
|
You could have edited your question and updated it instead of replying to your question. Further, adding the solution might be helpful to others.
|
|
|
|
|
I will correct this from the next time. Thanks a lot.
suchita
|
|
|
|
|
|
I added following code in usrcntrl1.ascx page .
<%@ Register src="usrcntrl2.ascx" tagname="Admin" tagprefix="admin" %>
<asp:PlaceHolder ID = "pHolAdmin" runat="server" visible="true" />
then I wrote following code in usrcntrl1_pageload.
Control cntrl = LoadControl("usrcntrl2.ascx");
cntrl.Visible = true;
pHolAdmin.Controls.Clear();
pHolAdmin.Controls.Add(cntrl);
it worked and problem solved..
suchita
|
|
|
|
|
I have one WebUserControl, in that in have placed one UpdatePanel after that i have placed one Button.
Finally I have placed that UserControl on my new WebForm.
structure -
WebUserControl -> Updatepanel ->Button
and New WebForm->WebUserContol
Now I want to show JavaScript alert window when i m pressing Button from code behind. fot that i have written-
ScriptManager.RegisterStartupScript(this,typeof(this.getType()) ,"ScriptKey","alert('HI')", true);
But it is not working.Plz help me .
Thank's in advance.
|
|
|
|
|
Not sure if you have figured it out yet, but I think the problem is where you register your startup script.
It should point to the page (page where the control is loaded) and not to the control itself.
You can try : ScriptManager.RegisterStartupScript(this.Page,typeof(this.Page.getType()) ,"ScriptKey","alert('HI')", true);
Hope this helps.
|
|
|
|
|
I have been struggling with this all week end ....
I am use Visual Web Developer 2010 Express.
I am trying to implement adding a new record using the Gridview footer.
I have an example that works fine that I got from http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx.
My situation is a little different .. as I am using master page and the Gridview is in a page derived from the master page.
I have tried:
Dim txtNewName As TextBox = DirectCast(GridView1.FooterRow.FindControl("NewName"), TextBox)
"NewName" is the ID of one the textbox controls in the footer of the Gridview.
When I try referencing ... txtNewName.Text ... it returns a null value.
There must be some trick to referencing this .Text value when using the Gridview that is within a Content Place Holder that results when using a page that was created using a master page.
Thanks in advance for any possible help with this problem ...
R. Hicks
modified on Sunday, September 19, 2010 9:15 PM
|
|
|
|
|
I ma trying to determine if user is browsing my website from mobile device. I found the IsMobileDevice and tried to use it this way:
<pre>
if (Request.Browser.IsMobileDevice == true)
{
Response.Redirect("http://mobile.JassimRahma.com/");
}
</pre>
but whenI browsed from my Blackberry Curve 8520 it's going to the normail website (full) which means it didn't determine it's a mobile? why? and how can fix this?<pre></pre>
|
|
|
|