|
Vanamaindia wrote: 'm used Like This Response.Write(PreviousPage.ClientID)
What do you want to get?
If you want previous page URL, use my first post code
please don't forget to vote on the post that helped you.
|
|
|
|
|
string preURL=Request.UrlReferrer.ToString();
It Gives Error Like Object reference not set to an instance of an object.
|
|
|
|
|
Try this.
HTML File
=========
<title>Untitled Page
Page_Load event of Default.aspx
===============================
Response.Write (Request.UrlReferrer.ToString ());
|
|
|
|
|
Vanamaindia wrote: string preURL=Request.UrlReferrer.ToString();
It Gives Error Like Object reference not set to an instance of an object.
You should check the Referrer is null before continuing. Pages that don't have referrer will throw this error. Do a null check before you access ToString()
|
|
|
|
|
Hi,
try this..
string url = Request.ServerVariables["HTTP_REFERER"];<br />
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
|
|
plz repeat the question clearly
|
|
|
|
|
It is Clear.....I can Search in Google..
|
|
|
|
|
hai,
my req is i need to add items from database into dropdownlist my code follows this way:
form id="form1" runat="server">
<asp:detailsview id="DetailsViewEnquiryEdit" runat="server" autogeneraterows="False"
="" datasourceid="ObjectDataSource1" height="50px" width="188px">
<fields>
<asp:boundfield datafield="EnquiryId" headertext="EnquiryId" sortexpression="EnquiryId">
<asp:boundfield datafield="EnquiryName" headertext="EnquiryName" sortexpression="EnquiryName">
<asp:boundfield datafield="EnquiryStatus" headertext="EnquiryStatus" sortexpression="EnquiryStatus">
<asp:boundfield datafield="EnquiryDesc" headertext="EnquiryDesc" sortexpression="EnquiryDesc">
<asp:boundfield datafield="SourceId" headertext="SourceId" sortexpression="SourceId">
<asp:boundfield datafield="CustomerId" headertext="CustomerId" sortexpression="CustomerId">
<asp:boundfield datafield="ServiceId" headertext="ServiceId" sortexpression="ServiceId">
<asp:boundfield datafield="CountryId" headertext="CountryId" sortexpression="CountryId">
<asp:templatefield headertext="CountryName">
<edititemtemplate>
<asp:dropdownlist id="DropDownList1" runat="server" datasourceid="SqlDataSource1"
="" datatextfield="CountryName" datavaluefield="CountryName" selectedvalue="<%# Bind("CountryName") %>">
<asp:sqldatasource id="SqlDataSource2" runat="server" connectionstring="<%$ ConnectionStrings:System.Data.SqlClient %>"
="" selectcommand="SELECT [CountryName] FROM [tb_country]">
<itemtemplate>
<asp:label id="Label1" runat="server" text="<%# Bind("CountryName") %>">
<footertemplate>
<asp:button id="Button1" runat="server" text="Save" onclick="Button1_Click">
<asp:button id="Button2" runat="server" text="Cancel" onclick="Button2_Click">
.
<asp:objectdatasource id="ObjectDataSource1" runat="server" oldvaluesparameterformatstring="original_{0}"
="" selectmethod="GetEnquiry" typename="gfinFacade.EnquiryFacade">
<selectparameters>
<asp:sessionparameter name="enqId" sessionfield="enqId" type="Int32">
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:gfinConnectionString %>"
="" selectcommand="SELECT [CountryName] FROM [tb_Country]">
but i am getting error like
'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
can anybodu tell how to solve this
padma
|
|
|
|
|
Hi,
check the items in the datasource before you execute,
it must have changed i believe
|
|
|
|
|
hai,
my req is i need to add items from database into dropdownlist my code follows this way:
form id="form1" runat="server">
<asp:detailsview id="DetailsViewEnquiryEdit" runat="server" autogeneraterows="False"
="" datasourceid="ObjectDataSource1" height="50px" width="188px">
<fields>
<asp:boundfield datafield="EnquiryId" headertext="EnquiryId" sortexpression="EnquiryId">
<asp:boundfield datafield="EnquiryName" headertext="EnquiryName" sortexpression="EnquiryName">
<asp:boundfield datafield="EnquiryStatus" headertext="EnquiryStatus" sortexpression="EnquiryStatus">
<asp:boundfield datafield="EnquiryDesc" headertext="EnquiryDesc" sortexpression="EnquiryDesc">
<asp:boundfield datafield="SourceId" headertext="SourceId" sortexpression="SourceId">
<asp:boundfield datafield="CustomerId" headertext="CustomerId" sortexpression="CustomerId">
<asp:boundfield datafield="ServiceId" headertext="ServiceId" sortexpression="ServiceId">
<asp:boundfield datafield="CountryId" headertext="CountryId" sortexpression="CountryId">
<asp:templatefield headertext="CountryName">
<edititemtemplate>
<asp:dropdownlist id="DropDownList1" runat="server" datasourceid="SqlDataSource1"
="" datatextfield="CountryName" datavaluefield="CountryName" selectedvalue="<%# Bind("CountryName") %>">
<asp:sqldatasource id="SqlDataSource2" runat="server" connectionstring="<%$ ConnectionStrings:System.Data.SqlClient %>"
="" selectcommand="SELECT [CountryName] FROM [tb_country]">
<itemtemplate>
<asp:label id="Label1" runat="server" text="<%# Bind("CountryName") %>">
<footertemplate>
<asp:button id="Button1" runat="server" text="Save" onclick="Button1_Click">
<asp:button id="Button2" runat="server" text="Cancel" onclick="Button2_Click">
.
<asp:objectdatasource id="ObjectDataSource1" runat="server" oldvaluesparameterformatstring="original_{0}"
="" selectmethod="GetEnquiry" typename="gfinFacade.EnquiryFacade">
<selectparameters>
<asp:sessionparameter name="enqId" sessionfield="enqId" type="Int32">
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:gfinConnectionString %>"
="" selectcommand="SELECT [CountryName] FROM [tb_Country]">
but i am getting error like
'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
can anybodu tell how to solve this
padma
|
|
|
|
|
hi all
gud morning.can anyone tell me how to export a crystal report to pdf format through c# coding(programatically)
pintoo
|
|
|
|
|
Dim oStream As New System.IO.MemoryStream
oStream = crEnquiryReport.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/pdf"
Response.BinaryWrite(oStream.ToArray())
Response.End()
|
|
|
|
|
If we have a database where we can store all the users list.If any of them are in online we want to conference chat with all the online users.Is any code available for this conference.I attach one code with this mail .In that code we can chat with one -to-one users as in gmail or rediff web application.But if i want to chat with more than one users like conference chat in yahoo messenger,what changes i need.if i specify the window name by any string not with users name specifing by a variable,the conference is possible.Please help sir .I want to implement this in my project.Early u people send some links to me ,but all are using dlls so i cant integrate it in my pjct.Kindly help....The code is attached below.
//Code to send msg to the online user
protected void BtnSend_Click(object sender, EventArgs e)
{
string toUserName;
string chatMsg;
DateTime chatDate;
string fromUserName;
try
{
fromUserName = User.Identity.Name;
toUserName = HidToUser.Value;
MembershipUser objMemberTo = Membership.GetUser(toUserName);
if (objMemberTo.IsOnline == false)
{
lblMsg.Visible = true;
lblMsg.Text = toUserName + "is Offline now. ";
}
chatMsg = ChatText.Text;
chatDate = System.DateTime.Now.ToLocalTime();
string fromUserID, toUserID;
MembershipUser objMemberFrom = Membership.GetUser(fromUserName);
fromUserID = objMemberFrom.ProviderUserKey.ToString();
//MembershipUser objMemberTo = Membership.GetUser(toUserName);
toUserID = objMemberTo.ProviderUserKey.ToString();
if (!string.IsNullOrEmpty(ChatText.Text))
{
if (ChatText.MaxLength <= 4000)
{
db_chat.InsertChatMessage(fromUserID, toUserID, chatMsg, chatDate, false);
}
}
DisplayChatMessage();
Label1.Text = "tony";
lblMsg.Text = "hai";
}
finally
{
}
}
protected void DisplayChatMessage()
{
DataTable dtChatMsg;
string fromUser;
string toUser;
string toUid, fromUid;
fromUser = User.Identity.Name;
toUser = HidToUser.Value;
MembershipUser objMemberTo = Membership.GetUser(toUser);
toUid = objMemberTo.ProviderUserKey.ToString();
MembershipUser objMemberFrom = Membership.GetUser(fromUser);
fromUid = objMemberFrom.ProviderUserKey.ToString();
DateTime loginTime = new DateTime();
loginTime = objMemberFrom.LastLoginDate;
dtChatMsg = db_chat.GetChatMessage(toUid, fromUid, loginTime);
DataColumn dc = new DataColumn("UserName");
dc.DataType = System.Type.GetType("System.String");
dtChatMsg.Columns.Add(dc);
if (dtChatMsg.Rows.Count > 0)
{
foreach (DataRow dr in dtChatMsg.Rows)
{
if (dr["FromUser"].ToString() == fromUid)
{
dr["UserName"] = "me";
}
else if (dr["FromUser"].ToString() == toUid)
{
dr["UserName"] = toUser;
}
}
Chatlist.DataSource = dtChatMsg;
Chatlist.DataBind();
}
}
}
|
|
|
|
|
I set all my business layer classes as sealed class. I did like this because I read from somewhere that this will improve the performance. Is it true?
Thanks and Regards,
Hogan
|
|
|
|
|
hogan.smith wrote: I read from somewhere that this will improve the performance. Is it true?
I set the class as sealed class when I want to prevent derivation.. That's all. I never heard that the sealed class is better than the normal class..
|
|
|
|
|
A sealed class cannot be used as a base class. For this reason, it cannot also be an abstract class. Sealed classes are primarily used to prevent derivation. Because they can never be used as a base class, some run-time optimizations can make calling sealed class members slightly faster.
I copied the above sentance from MSDN 2005
Thanks,
Hogan
|
|
|
|
|
CREATE PROCEDURE CREATENEWS @strtitle nvarchar(500), @strDescription nvarchar(800), @strDate nvarchar(50), @categoryid int, @type int, @content ntext , @ivalue int out
AS
Begin
SET NOCOUNT ON
INSERT INTO tblNews (title, description,datepost, categoryid, typenews, content)
VALUES (@strtitle, @strDescription, @strDate,@categoryid, @type, @content)
SET @ivalue = SCOPE_IDENTITY()
END
GO
How can i get @ivalue or SCOPE_IDENTITY() asp.net
|
|
|
|
|
1. Return the SCOPE_IDENTITY() from stored procedure
2. Use ExecuteScalar to get this value.
|
|
|
|
|
|
Hello Everyone,
I did a little searching around and couldn't find a good answer to this problem. I have multiple files, of multiple file types, that I would like to push to the client side with one button click. I'm doing one at a time just fine in the following fashion:
PDFGenerator oPDFGenerator = new PDFGenerator();
byte[] oByte = oPDFGenerator.Genereate52670a1PDF(Page.Request.PhysicalApplicationPath);
if (oByte != null)
{
this.Page.Response.ContentType = "application/pdf";
this.Page.Response.AddHeader("Content-Disposition", "attachment; filename=52670a1.pdf");
this.Page.Response.BinaryWrite(oByte);
this.Page.Response.Flush();
this.Page.Response.End();
}
Any idea on how I could pull this off with multiple files? Thanks for any suggestions in advance,
Ryan
|
|
|
|
|
u will have to zip the files and then display..
|
|
|
|
|
Hi gurus.
I need to create floor map for each (4 floors) floor in my company new building.
Map should be similar to Google maps i.e. when map is viewed (image) I want to show employee names in their cubicles. When specific person is searched I want to show where he seats (just that person). Employee (name) should be tied to Office Communicator (IM), which shows status of the person. I can get employee information from Active Directory (name, title, email, etc.)
Did anyone have any experience doing this? Any help would be greatly appreciated.
If I didn't explain good enough let me know and I will try as best as I can.
Thank you all,
Alex.
|
|
|
|
|
Don't cross post. Pick either this forum or the VB.NET forum and wait for a reply
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|