|
Hi Mr.Michael Sync..
Thank u soo much ur code is working . but header for that grid also moving in Mozilla in IE header is fixed , but Mozilla header is moving .. so please try for this . thank soo much
Reg
nantha
|
|
|
|
|
Hello
I have 2 Memory streams of 2 pdf files. Now i want to combine these 2 files into a single file ie 2 memory streams put together as single stream and print on the page using
HttpContext.Current.Response.BinaryWrite(combinedMemoryStream)
How to do it? Help needed urgently.
Thanks and Regards
Help in need is the help indeed
|
|
|
|
|
Hello,
I have used a Datalist to display the records...i want to give provision for users to edit their record...How can l implement this by using datalist????If any idea Please help me.....
Thanks in advance
Bijesh
|
|
|
|
|
Sample
------
<asp:DataList ID="dlGallery" OnEditCommand="dl_GalleryEdit" OnCancelCommand="dl_GalleryCancel" OnUpdateCommand="dl_GalleryUpdate" DataKeyField="ID" runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" /> |
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblGalleryChgUser" Text="Username: " runat="Server" /><br />
<asp:TextBox ID="txtGalleryChgUser" Text='<%# DataBinder.Eval(Container.DataItem, "username") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" /> |
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast" runat="server" />
</EditItemTemplate>
</asp:DataList>
protected void dl_GalleryEdit(Object s, DataListCommandEventArgs e) {
dlGallery.EditItemIndex = e.Item.ItemIndex;
//Update Code
bindData();
}
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello....
Please help How we can regonize the specified item want to change
by using this code
dlGallery.EditItemIndex = e.Item.ItemIndex;
our item template like this......
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %>
</ItemTemplate>
How we can get the value of item??????
Please help to solve my problem
thanks
Biju
|
|
|
|
|
What about EditTemplate?
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" /> |
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtUserName" Text='<%# DataBinder.Eval(Container.DataItem, "username") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="txtCategory" Text='<%# DataBinder.Eval(Container.DataItem, "category") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" /> |
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast" runat="server" />
</EditItemTemplate>
Check-out this example
<a href = "http://authors.aspalliance.com/aspxtreme/webforms/controls/allowinguserstoedititemsindatalist.aspx" rel="nofollow">http://authors.aspalliance.com/aspxtreme/webforms/controls/allowinguserstoedititemsindatalist.aspx</a>
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello,
I set the code like this in html......
-----------------------------------------------------------------------------
<asp:datalist id="dlGallery" runat="server" OnCancelCommand="dlGallery_CancelCommand" OnUpdateCommand="dlGallery_UpdateCommand"
OnEditCommand="dlGallery_EditCommand" EditItemStyle-BackColor="lightgreen" AlternatingItemStyle-BackColor="Gainsboro"
HeaderStyle-BackColor="#aaaadd" Width="150px" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0"
CellPadding="3" GridLines="Both" BorderWidth="1" BorderColor="black" DataKeyField="AD_TITLE">
<ItemTemplate>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Textbox1" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox2" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TYPE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox3" Text='<%# DataBinder.Eval(Container.DataItem, "category_id") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox4" Text='<%# DataBinder.Eval(Container.DataItem, "AD_DESCRIPTION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox5" Text='<%# DataBinder.Eval(Container.DataItem, "area") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox6" Text='<%# DataBinder.Eval(Container.DataItem, "unit") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox7" Text='<%# DataBinder.Eval(Container.DataItem, "PRICE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox8" Text='<%# DataBinder.Eval(Container.DataItem, "WebUrl") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox9" Text='<%# DataBinder.Eval(Container.DataItem, "LOCATION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox10" Text='<%# DataBinder.Eval(Container.DataItem, "plotname") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox11" Text='<%# DataBinder.Eval(Container.DataItem, "EMAIL_ID") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox12" Text='<%# DataBinder.Eval(Container.DataItem, "PHONENO") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" />
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast"
runat="server" />
</EditItemTemplate>
</asp:datalist>
-----------------------------------------------------------------------------
and the C# code like this
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Newclassified
{
/// <summary>
/// Summary description for samble11.
/// </summary>
public class Youradvts : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList dlGallery;
protected System.Web.UI.WebControls.DataList DataList1;
DataTable dt;
SqlDataReader sdr;
public DataTable Cart;
protected System.Web.UI.WebControls.Label lblmem_id;
public DataView CartView;
connection constr=new connection();
private void Page_Load(object sender, System.EventArgs e)
{
if (Session["DL3_ShoppingCart"] == null)
{
Cart = new DataTable();
Cart.Columns.Add(new DataColumn("Title", typeof(string)));
Cart.Columns.Add(new DataColumn("Type", typeof(string)));
Cart.Columns.Add(new DataColumn("Category", typeof(string)));
Cart.Columns.Add(new DataColumn("Description", typeof(string)));
Cart.Columns.Add(new DataColumn("Area", typeof(string)));
Cart.Columns.Add(new DataColumn("Unit", typeof(string)));
Cart.Columns.Add(new DataColumn("Price", typeof(string)));
Cart.Columns.Add(new DataColumn("Web URL", typeof(string)));
Cart.Columns.Add(new DataColumn("Location", typeof(string)));
Cart.Columns.Add(new DataColumn("Name", typeof(string)));
Cart.Columns.Add(new DataColumn("Email ID", typeof(string)));
Cart.Columns.Add(new DataColumn("Phone No", typeof(string)));
Session["DL3_ShoppingCart"] = Cart;
// first load -- prepopulate with some data
for (int i=1; i<5; i++)
{
// dr[0] = ((int)((i%2)+1)).ToString();
// dr[1] = "Item " + i.ToString();
// dr[2] = ((double)(1.23 * (i+1))).ToString();
DataRow dr = Cart.NewRow();
dr[0] = "Title" + i.ToString();
dr[1] = "Type " + i.ToString();
dr[2] = "Category" + i.ToString();
dr[3] = "Description" + i.ToString();
dr[4] = "Area " + i.ToString();
dr[5] = "Unit" + i.ToString();
dr[6] = "Price" + i.ToString();
dr[7] = "WebURL" + i.ToString();
dr[8] = "Location"+i.ToString();
dr[9] = "Name"+i.ToString();
dr[10] = "Email ID " + i.ToString();
dr[11] = "Phone No"+i.ToString();
Cart.Rows.Add(dr);
}
}
else
Cart = (DataTable)Session["DL3_ShoppingCart"];
CartView = new DataView(Cart);
//CartView.Sort = "Item";
if (!IsPostBack)
BindList();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dlGallery.SelectedIndexChanged += new System.EventHandler(this.dlGallery_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
void BindList()
{
try
{
connection constr=new connection();
string ss=Session["uid"].ToString();
string mem_id;
string sstr1="select id from tbl_userreg where username='"+ss+"'";
sdr=constr.reader(sstr1);
while(sdr.Read())
{
mem_id=sdr["id"].ToString();
lblmem_id.Text=mem_id.ToString();
}
string str="select AD_TITLE,AD_TYPE,AD_DESCRIPTION,category_id,LOCATION,EMAIL_ID,PHONENO,DATE_POSTED from ads where member_id="+Convert.ToInt32(lblmem_id.Text.ToString())+"";
dt=new DataTable();
dt=constr.ExQselect(str);
if(dt.Rows[0].ItemArray[0].ToString()=="")
{
lblmem_id.Visible=true;
lblmem_id.Text="Please Add Your Advertisement";
}
dlGallery.DataSource=dt;
dlGallery.DataBind();
}
catch
{
lblmem_id.Visible=true;
lblmem_id.Text="Kindly Register YourSelf To ADVERTISE FREELY For 60 Days";
}
}
private void dlGallery_EditCommand(object sender, System.EventArgs e)
{
//dlGallery.EditItemIndex = e.AD_TITLE.ItemIndex;
BindList();
}
private void dlGallery_UpdateCommand(object sender, System.EventArgs e)
{
// string item = ((System.Web.UI.WebControls.Label)e.AD_TITLE.FindControl("Label1")).Text;
// string qty = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text1")).Text;
string title = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text1")).Text;
string type= ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text2")).Text;
string category = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text3")).Text;
string description = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text4")).Text;
string area = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text5")).Text;
string unit= ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text6")).Text;
string price = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text7")).Text;
string weburl = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text8")).Text;
string location = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text9")).Text;
string name= ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text10")).Text;
string emailid = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text11")).Text;
string phoneno= ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text12")).Text;
// with a database, we'd use an update command. Since we're using an in-memory
// DataTable, we'll delete the old row and replace it with a new one
//remove old entry
//CartView.RowFilter = "Item='"+item+"'";
if (CartView.Count > 0) //item exists in cart
CartView.Delete(0);
CartView.RowFilter = "";
//add new entry
DataRow dr = Cart.NewRow();
dr[0] = title;
dr[1] = type;
dr[2] = category;
dr[3] = description;
dr[4] = area;
dr[5] = unit;
dr[6] = price;
dr[7] = weburl;
dr[8] = location;
dr[9] = name;
dr[10] = emailid;
dr[11] = phoneno;
Cart.Rows.Add(dr);
dlGallery.EditItemIndex = -1;
BindList();
}
private void dlGallery_CancelCommand(object sender, System.EventArgs e)
{
dlGallery.EditItemIndex = -1;
BindList();
}
-------------------------------------------------------------------------
But while running getting the error like this
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(159): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(160): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(158): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(166): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(165): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(164): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\index.aspx(2616): Could not find any attribute 'align' of element 'marquee'.
---------------------------------------------------------------------------
please help me to solve this problem.....
thanks
Bijesh
|
|
|
|
|
bijeshputhalath wrote: string title = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text1")).Text;
You should remove "AD_TITLE ".
string title = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text;
bijeshputhalath wrote: C:\Inetpub\wwwroot\approvedplotfinal\index.aspx(2616): Could not find any attribute 'align' of element 'marquee'.
Where do you set "marquee" in your code??
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello
while i removing AD_TITLE and try with your suggestion....But the following error comes
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(151): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(171): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(170): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(164): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(166): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(165): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(160): 'System.EventArgs' does not contain a definition for 'FindControl'
-----------------------------------------------------------------------------
Now My code is below
---------------------------------
private void dlGallery_EditCommand(object sender, System.EventArgs e)
{
dlGallery.EditItemIndex = e.AD_TITLE.ItemIndex;
BindList();
}
private void dlGallery_updateCommand(object sender, System.EventArgs e)
{
// string item = ((System.Web.UI.WebControls.Label)e.FindControl("Label1")).Text;
// string qty = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text;
string title = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text;
string type= ((System.Web.UI.WebControls.TextBox)e.FindControl("Text2")).Text;
string category = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text3")).Text;
string description = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text4")).Text;
string area = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text5")).Text;
string unit= ((System.Web.UI.WebControls.TextBox)e.FindControl("Text6")).Text;
string price = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text7")).Text;
string weburl = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text8")).Text;
string location = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text9")).Text;
string name= ((System.Web.UI.WebControls.TextBox)e.FindControl("Text10")).Text;
string emailid = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text11")).Text;
string phoneno= ((System.Web.UI.WebControls.TextBox)e.FindControl("Text12")).Text;
// with a database, we'd use an update command. Since we're using an in-memory
// DataTable, we'll delete the old row and replace it with a new one
//remove old entry
//CartView.RowFilter = "Item='"+item+"'";
if (CartView.Count > 0) //item exists in cart
CartView.Delete(0);
CartView.RowFilter = "";
//add new entry
DataRow dr = Cart.NewRow();
dr[0] = title;
dr[1] = type;
dr[2] = category;
dr[3] = description;
dr[4] = area;
dr[5] = unit;
dr[6] = price;
dr[7] = weburl;
dr[8] = location;
dr[9] = name;
dr[10] = emailid;
dr[11] = phoneno;
Cart.Rows.Add(dr);
dlGallery.EditItemIndex = -1;
BindList();
}
----------------------------------------------------------------------------
<asp:datalist id="dlGallery" runat="server" OnCancelCommand="dlGallery_cancelCommand" OnUpdateCommand="dlGallery_updateCommand"
OnEditCommand="dlGallery_EditCommand" EditItemStyle-BackColor="lightgreen" AlternatingItemStyle-BackColor="Gainsboro"
HeaderStyle-BackColor="#aaaadd" Width="150px" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0"
CellPadding="3" GridLines="Both" BorderWidth="1" BorderColor="black" DataKeyField="AD_TITLE">
<ItemTemplate>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Textbox1" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox2" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TYPE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox3" Text='<%# DataBinder.Eval(Container.DataItem, "category_id") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox4" Text='<%# DataBinder.Eval(Container.DataItem, "AD_DESCRIPTION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox5" Text='<%# DataBinder.Eval(Container.DataItem, "area") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox6" Text='<%# DataBinder.Eval(Container.DataItem, "unit") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox7" Text='<%# DataBinder.Eval(Container.DataItem, "PRICE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox8" Text='<%# DataBinder.Eval(Container.DataItem, "WebUrl") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox9" Text='<%# DataBinder.Eval(Container.DataItem, "LOCATION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox10" Text='<%# DataBinder.Eval(Container.DataItem, "plotname") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox11" Text='<%# DataBinder.Eval(Container.DataItem, "EMAIL_ID") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox12" Text='<%# DataBinder.Eval(Container.DataItem, "PHONENO") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" />
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast"
runat="server" />
</EditItemTemplate>
</asp:datalist>
----------------------------------------------------------
please help me to trace out ...
thanks
bijesh
|
|
|
|
|
Sorry.. my mistake ..
Try again with the following code.
e.Item.FindControl("")
If it is not still working, I wanna know a few thing and will make a sample download for you.
1. Are you using VS 2003 or 2005?
2. Are those column in DataList the bounded column or unbounded?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello
Thank you for your reply....
1. Are you using VS 2003 or 2005? <b>Ans: vs2003</b>
2. Are those column in DataList the bounded column or unbounded? <b>Ans:Bounded</b>
i try it with <b> e.Item.FindControl("")</b>
But still the same error comes......
-------------------------------------------------------------------------
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(159): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(171): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(170): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'Item'
----------------------------------------------------------------------------
<big>Then i hide(//give comment lines and try if the Datalist showing the items or not</big> <code><b> But the Error is like this ......What is my mistake, i cant recognize...???please help me to find it out.............</b></code>
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0122: 'Newclassified.Youradvts.dlGallery_cancelCommand(object, System.EventArgs)' is inaccessible due to its protection level
Source Error:
Line 7103: </tr>
Line 7104: </table>
Line 7105: <asp:datalist id="dlGallery" runat="server" OnCancelCommand="dlGallery_cancelCommand" OnUpdateCommand="dlGallery_updateCommand"
Line 7106: OnEditCommand="dlGallery_EditCommand" EditItemStyle-BackColor="lightgreen" AlternatingItemStyle-BackColor="Gainsboro"
Line 7107: HeaderStyle-BackColor="#aaaadd" Width="150px" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0"
Source File: http://localhost/approvedplotfinal/classified/Youradvts.aspx Line: 7105
-----------------------------------------------------------------------------
<big><b>This is my HTML code</b></big>
<asp:datalist id=dlGallery DataKeyField="AD_TITLE" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size="8pt" Width="150px" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="Gainsboro" EditItemStyle-BackColor="lightgreen" OnEditCommand="dlGallery_EditCommand" OnUpdateCommand="dlGallery_updateCommand" OnCancelCommand="dlGallery_cancelCommand" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Textbox1" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox2" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TYPE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox3" Text='<%# DataBinder.Eval(Container.DataItem, "category_id") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox4" Text='<%# DataBinder.Eval(Container.DataItem, "AD_DESCRIPTION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox5" Text='<%# DataBinder.Eval(Container.DataItem, "area") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox6" Text='<%# DataBinder.Eval(Container.DataItem, "unit") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox7" Text='<%# DataBinder.Eval(Container.DataItem, "PRICE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox8" Text='<%# DataBinder.Eval(Container.DataItem, "WebUrl") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox9" Text='<%# DataBinder.Eval(Container.DataItem, "LOCATION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox10" Text='<%# DataBinder.Eval(Container.DataItem, "plotname") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox11" Text='<%# DataBinder.Eval(Container.DataItem, "EMAIL_ID") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox12" Text='<%# DataBinder.Eval(Container.DataItem, "PHONENO") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" />
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast"
runat="server" />
</EditItemTemplate>
</asp:datalist></TD>
----------------------------------------------------------------------------
This is my aspx.cs page
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Newclassified
{
/// <summary>
/// Summary description for samble11.
/// </summary>
public class Youradvts : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList dlGallery;
protected System.Web.UI.WebControls.DataList DataList1;
DataTable dt;
SqlDataReader sdr;
public DataTable Cart;
protected System.Web.UI.WebControls.Label lblmem_id;
public DataView CartView;
connection constr=new connection();
private void Page_Load(object sender, System.EventArgs e)
{
if (Session["DL3_ShoppingCart"] == null)
{
Cart = new DataTable();
Cart.Columns.Add(new DataColumn("AD_TITLE", typeof(string)));
Cart.Columns.Add(new DataColumn("Type", typeof(string)));
Cart.Columns.Add(new DataColumn("Category", typeof(string)));
Cart.Columns.Add(new DataColumn("Description", typeof(string)));
Cart.Columns.Add(new DataColumn("Area", typeof(string)));
Cart.Columns.Add(new DataColumn("Unit", typeof(string)));
Cart.Columns.Add(new DataColumn("Price", typeof(string)));
Cart.Columns.Add(new DataColumn("Web URL", typeof(string)));
Cart.Columns.Add(new DataColumn("Location", typeof(string)));
Cart.Columns.Add(new DataColumn("Name", typeof(string)));
Cart.Columns.Add(new DataColumn("Email ID", typeof(string)));
Cart.Columns.Add(new DataColumn("Phone No", typeof(string)));
Session["DL3_ShoppingCart"] = Cart;
// first load -- prepopulate with some data
for (int i=1; i<5; i++)
{
// dr[0] = ((int)((i%2)+1)).ToString();
// dr[1] = "Item " + i.ToString();
// dr[2] = ((double)(1.23 * (i+1))).ToString();
DataRow dr = Cart.NewRow();
dr[0] = "Title" + i.ToString();
dr[1] = "Type " + i.ToString();
dr[2] = "Category" + i.ToString();
dr[3] = "Description" + i.ToString();
dr[4] = "Area " + i.ToString();
dr[5] = "Unit" + i.ToString();
dr[6] = "Price" + i.ToString();
dr[7] = "WebURL" + i.ToString();
dr[8] = "Location"+i.ToString();
dr[9] = "Name"+i.ToString();
dr[10] = "Email ID " + i.ToString();
dr[11] = "Phone No"+i.ToString();
Cart.Rows.Add(dr);
}
}
else
Cart = (DataTable)Session["DL3_ShoppingCart"];
CartView = new DataView(Cart);
//CartView.Sort = "Item";
if (!IsPostBack)
BindList();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dlGallery.SelectedIndexChanged += new System.EventHandler(this.dlGallery_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
void BindList()
{
try
{
connection constr=new connection();
string ss=Session["uid"].ToString();
string mem_id;
string sstr1="select id from tbl_userreg where username='"+ss+"'";
sdr=constr.reader(sstr1);
while(sdr.Read())
{
mem_id=sdr["id"].ToString();
lblmem_id.Text=mem_id.ToString();
}
string str="select AD_TITLE,AD_TYPE,AD_DESCRIPTION,category_id,LOCATION,EMAIL_ID,PHONENO,DATE_POSTED from ads where member_id="+Convert.ToInt32(lblmem_id.Text.ToString())+"";
dt=new DataTable();
dt=constr.ExQselect(str);
if(dt.Rows[0].ItemArray[0].ToString()=="")
{
lblmem_id.Visible=true;
lblmem_id.Text="Please Add Your Advertisement";
}
dlGallery.DataSource=dt;
dlGallery.DataBind();
}
catch
{
lblmem_id.Visible=true;
lblmem_id.Text="Kindly Register YourSelf To ADVERTISE FREELY For 60 Days";
}
}
private void dlGallery_EditCommand(object sender, System.EventArgs e)
{
dlGallery.EditItemIndex = e.Item.ItemIndex;
BindList();
}
private void dlGallery_updateCommand(object sender, System.EventArgs e)
{
string item = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label1")).Text;
string qty = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text1")).Text;
string title = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text1")).Text;
string type= ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text2")).Text;
string category = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text3")).Text;
string description = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text4")).Text;
string area = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text5")).Text;
string unit= ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text6")).Text;
string price = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text7")).Text;
string weburl = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text8")).Text;
string location = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text9")).Text;
string name= ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text10")).Text;
string emailid = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text11")).Text;
string phoneno= ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text12")).Text;
// with a database, we'd use an update command. Since we're using an in-memory
// DataTable, we'll delete the old row and replace it with a new one
//remove old entry
//CartView.RowFilter = "Item='"+item+"'";
if (CartView.Count > 0) //item exists in cart
CartView.Delete(0);
CartView.RowFilter = "";
//add new entry
DataRow dr = Cart.NewRow();
dr[0] = title;
dr[1] = type;
dr[2] = category;
dr[3] = description;
dr[4] = area;
dr[5] = unit;
dr[6] = price;
dr[7] = weburl;
dr[8] = location;
dr[9] = name;
dr[10] = emailid;
dr[11] = phoneno;
Cart.Rows.Add(dr);
dlGallery.EditItemIndex = -1;
BindList();
}
private void dlGallery_cancelCommand(object sender, System.EventArgs e)
{
dlGallery.EditItemIndex = -1;
BindList();
}
-------------------------------------------------------------------------
Please help me to find out....
Thanks
Biju
|
|
|
|
|
|
hi all,
On the top 100 pages of a site I would like to add a list of pages that people who visited that page had also visited during their visit.
i will at the maximum post 5 links that was visited by the people.
Is there any way to get this kind of information?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
anu81 wrote: I would like to add a list of pages that people who visited that page had also visited during their visit.
What do you mean by this ?
anu81 wrote: i will at the maximum post 5 links that was visited by the people.
Do you want to track the user visited pages ?
|
|
|
|
|
hi,
yes, i want to track the pages visited by the user and based on this i need to recommend the user the most visited pages.
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
|
hi,
thanks for the reply. but i don't want to know the number of visitors who visited my site.rather i would like to know the pages they visited in the site.
Hope i am clear in my explanation
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
|
once again thanks. but still the code just demonstrates only the count of visitors and not the links they visited. i tried searching in the google and found only links for storing the hit counter for the site.
Could you please guide me to any link for storing the information about the urls visited by the user for a site.
Thanks again
Regards
Anuradha
|
|
|
|
|
Below are my codes. I have created one webservice method to Upload the file.
I access this webservice in my aspx file. It compile's fine. But it always return the
result "2"
What is wrong in my code?
byte[] fileContent = null;
FileStream fStream = null;
string strPath = @"D:\XML Tutorial(Basics).doc";
string strFileName = Path.GetFileName(strPath);
int uploadStatus;
fStream = new FileStream(strPath, FileMode.Open, FileAccess.Read);
fileContent = new byte[fStream.Length];
fStream.Read(binFile, 0, (int)fStream.Length);
uploadStatus = spService1.UploadAndApproveContent(strFileName, fileContent, 1);
if (uploadStatus == 0)
Response.Write("File has been UpLoaded");
else if (uploadStatus == 2)
Response.Write("File doesn't Contain anything");
else
Response.Write("File doesn't uploaded");
[WebMethod]
public int UploadAndApproveContent(string fileName, byte[] fileContents ,int approvalStatus)
{
if (fileContents == null)
{
return 2;
}
try
{
fileName = "Tmp_" + fileName;
SPWeb site = new SPSite(srcUrl).OpenWeb();
SPFile spFile = site.GetFile(srcUrl + "/" + fileName);
SPFolder folder = site.GetFolder(srcUrl);
if (isFileExists(fileName))
{
spFile.CheckOut();
spFile.CheckedOutBy.LoginName.ToString();
}
else
{
folder.Files.Add(fileName, fileContents, true);
SPModerationInformation spModerationInformation = spFile.Item.ModerationInformation;
switch (approvalStatus)
{
case 1:
spModerationInformation.Status = SPModerationStatusType.Pending;
spModerationInformation.Comment = "Its pending";
spFile.Item.Update();
return 0;
case 2:
spModerationInformation.Status = SPModerationStatusType.Approved;
spModerationInformation.Comment = "Got the Approval";
spFile.Item.Update();
return 0;
case 3:
spModerationInformation.Status = SPModerationStatusType.Denied;
spModerationInformation.Comment = "Its Rejected";
spFile.Item.Update();
return 0;
default:
return 1;
}
}
}
catch
{
throw;
}
return 3;
}
|
|
|
|
|
Well based off your code your fileContents byte array must always be null. If you are always return 2 from your method call.
Ben
|
|
|
|
|
jayarajmrj wrote: if (fileContents == null)
{
return 2;
}
This is what is happening... The value of fileContents received by the webservice is null.
jayarajmrj wrote: fStream.Read(binFile, 0, (int)fStream.Length);
what is binFile ? Shouldn't that be: fStream.Read(fileContent, 0, (int)fStream.Length); instead?
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
By Default,when you do any update from code on sharepoint list item which has approval attached to it,it will be always be approved
|
|
|
|
|
i have two page a and b i cross from page a to page b so a is the previous page
the question IsCrossPagePostBack property
in page b in the load event
if i said [page.IsCrossPagePostBack]
mean is a is cross to page b
or mean
is b crossed from a
or what it mean
+++second question
if i want to check if page b is open throught page a or opened from it's self
md_refay
|
|
|
|
|
From MSDN:
ASP.NET provides two mechanisms for transferring control from one page to another. You can use the Transfer method to transfer processing between pages, or you can make a cross-page request by assigning a page URL to the PostBackUrl property of a button control that implements the IButtonControl interface. <br />
<br />
In either case, the PreviousPage page property will contain an object that represents the previous or originator page. If, for example, Page A posts to Page B, Page A's IsCrossPagePostBack property (accessible through the PreviousPage property) will be true and Page B's PreviousPage property will have the name of Page A.
For the second question, to check if page B is posted from itself, use the IsPostBack property.
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|