|
hi,
i need to transfer a key value from a page to a popup page "on selected index change" of a gridview.
i have used a asp:HyperLinkField, to navigate the url.
i got the page to pop up. I need to pass the key value.
plz help me out......
guys its urgent....
|
|
|
|
|
saurabh8april wrote: guys its urgent....
This is very rude around here. Answers are given voluntarily and although it may be urgent to you, it isn't to anyone else here.
The answer is very simple, but I only answer people who are not rude.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Use Session[""] = your key value in the source page, and get the value in the popup page.
modified 27-May-14 5:11am.
|
|
|
|
|
well i have tried avery possible way i can think, but all failed, when passing the value on index change.....
seems have to find an alternate to do this work
anyway thanks for u replies
|
|
|
|
|
Morning. I'm new to ASP.NET and MVC. I'm basically trying to implement an old Chat Application, which uses CodeBehind into my MVC application called SkyBlueBarmy. However, the kind of errors that I get are listed below.
Basically, I keep playing around with the inherits tag but get a different error each time. Is it possible for me to re-use this application in MVC. If so can somebody please give me some pointers because i'm struggling being new to the syntax, error messages and concept.
Thanks very much
Server Error in '/' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: 'Chat' is not allowed here because it does not extend class 'System.Web.Mvc.ViewPage'.
Source Error:
Line 1: <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" AutoEventWireup="true" CodeBehind="matchchat.aspx.cs" Inherits="Chat" %>
Line 2:
Line 3: <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Source File: /Views/chat/matchchat.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
or if I change Inherits to 'SkyBlueBarmy.View.Chat.matchchat'
Server Error in '/' Application.
--------------------------------------------------------------------------------
The view at '~/Views/chat/matchchat.aspx' must derive from ViewPage, ViewPage<TViewData>, ViewUserControl, or ViewUserControl<TViewData>.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The view at '~/Views/chat/matchchat.aspx' must derive from ViewPage, ViewPage<TViewData>, ViewUserControl, or ViewUserControl<TViewData>.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The view at '~/Views/chat/matchchat.aspx' must derive from ViewPage, ViewPage<TViewData>, ViewUserControl, or ViewUserControl<TViewData>.]
System.Web.Mvc.WebFormView.Render(ViewContext viewContext, TextWriter writer) +108499
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +278
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +10
System.Web.Mvc.<>c__DisplayClass11.<InvokeActionResultWithFilters>b__e() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251
System.Web.Mvc.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +178
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +399
System.Web.Mvc.Controller.ExecuteCore() +126
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
I've also changed it to System.Web.Mvc.ViewPage<matchchat> and System.Web.Mvc.ViewPage but have reached the guessing stage without understanding what is happening or if I can achieve it.
matchchat.aspx
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" AutoEventWireup="true" CodeBehind="matchchat.aspx.cs" Inherits="Chat" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
chat
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
function SetScrollPosition()
{
var div = document.getElementById('divMessages');
div.scrollTop = 100000000000;
}
function SetToEnd(txtMessage)
{
if (txtMessage.createTextRange)
{
var fieldRange = txtMessage.createTextRange();
fieldRange.moveStart('character', txtMessage.value.length);
fieldRange.collapse();
fieldRange.select();
}
}
function ReplaceChars()
{
var txt = document.getElementById('txtMessage').value;
var out = "<";
var add = "";
var temp = "" + txt;
while (temp.indexOf(out)>-1)
{
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.getElementById('txtMessage').value = temp;
}
function LogOutUser(result, context)
{
}
function LogMeOut()
{
LogOutUserCallBack();
}
</script>
<form id="form1" defaultbutton="btnSend" defaultfocus="txtMessage" runat="server" >
<div>
<asp:ScriptManager Id="ScriptManager1" runat="server" EnablePartialRendering="true" />
<asp:Label Id="lblRoomName" Font-Size="18px" runat="server" /><br /><br />
<asp:Label Id="lblRoomId" Visible="false" runat="server" />
<asp:UpdatePanel Id="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlId="Timer1" />
</Triggers>
<ContentTemplate>
<asp:Timer Id="Timer1" Interval="7000" OnTick="Timer1_OnTick" runat="server" />
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 500px;">
<div id="divMessages" style="background-color: White; border-color:Black;border-width:1px;border-style:solid;height:300px;width:592px;overflow-y:scroll; font-size: 11px; padding: 4px 4px 4px 4px;" onresize="SetScrollPosition()">
<asp:Literal Id="litMessages" runat="server" />
</div>
</td>
<td> </td>
<td>
<div id="divUsers" style="background-color: White; border-color:Black;border-width:1px;border-style:solid;height:300px;width:150px;overflow-y:scroll; font-size: 11px; padding: 4px 4px 4px 4px;">
<asp:Literal Id="litUsers" runat="server" />
</div>
</td>
</tr>
<tr>
<td colspan="3">
<asp:TextBox Id="txtMessage" onkeyup="ReplaceChars()" onfocus="SetToEnd(this)" runat="server" MaxLength="100" Width="500px" />
<asp:Button Id="btnSend" runat="server" Text="Send" OnClientClick="SetScrollPosition()" OnClick="BtnSend_Click" />
<b>Color:</b> <asp:DropDownList Id="ddlColor" runat="server">
<asp:ListItem Value="Black" Selected="true">Black</asp:ListItem>
<asp:ListItem Value="Blue">Blue</asp:ListItem>
<asp:ListItem Value="Navy">Navy</asp:ListItem>
<asp:ListItem Value="Red">Red</asp:ListItem>
<asp:ListItem Value="Orange">Orange</asp:ListItem>
<asp:ListItem Value="#666666">Gray</asp:ListItem>
<asp:ListItem Value="Green">Green</asp:ListItem>
<asp:ListItem Value="#FF00FF">Pink</asp:ListItem>
</asp:DropDownList>
<asp:Button Id="btnLogOut" Text="Log Out" runat="server"
OnClick="BtnLogOut_Click" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</asp:Content>
matchchat.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Text;
using SkyBlueBarmy.Models;
namespace SkyBlueBarmy.Views.Chat
{
public partial class matchchat : System.Web.UI.Page, System.Web.UI.ICallbackEventHandler
{
private string _callBackStatus;
private SkyBlueBarmyDataContext db = new SkyBlueBarmyDataContext();
Label lblRoomId;
Label lblRoomName;
TextBox txtMessage;
ScriptManager ScriptManager1;
DropDownList ddlColor;
Literal litUsers;
Literal litMessages;
public void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string roomId = (string)Request["roomId"];
lblRoomId.Text = roomId;
this.GetRoomInformation();
this.GetLoggedInUsers();
this.InsertMessage(ConfigurationManager.AppSettings["ChatLoggedInText"] + " " + DateTime.Now.ToString());
this.GetMessages();
string callBackReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "LogOutUser", "");
string logOutUserCallBackScript = "function LogOutUserCallBack(arg, context) { " + callBackReference + "; }";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "LogOutUserCallBack", logOutUserCallBackScript, true);
}
}
private void GetRoomInformation()
{
var room = (from r in db.Rooms
where r.roomid == Convert.ToInt32(lblRoomId.Text)
select r).SingleOrDefault();
lblRoomId.Text = room.roomid.ToString();
lblRoomName.Text = room.name;
}
public void BtnSend_Click(object sender, EventArgs e)
{
if (txtMessage.Text.Length > 0)
{
this.InsertMessage(null);
this.GetMessages();
txtMessage.Text = String.Empty;
ScriptManager1.SetFocus(txtMessage.ClientID);
}
}
public void Timer1_OnTick(object sender, EventArgs e)
{
this.GetLoggedInUsers();
this.GetMessages();
if ((string)Session["IsChatroomInFocus"] == null)
ScriptManager1.SetFocus(txtMessage);
}
private void InsertMessage(string text)
{
Message message = new Message();
message.roomid = Convert.ToInt32(lblRoomId.Text);
message.userid = Convert.ToInt32(Session["ChatUserID"]);
if (String.IsNullOrEmpty(text))
{
message.text = txtMessage.Text.Replace("<", "");
message.color = ddlColor.SelectedValue;
}
else
{
message.text = text;
message.color = "gray";
}
message.timestamp = DateTime.Now;
db.Messages.InsertOnSubmit(message);
db.SubmitChanges();
}
private void GetLoggedInUsers()
{
var user = (from u in db.Logged_In_Users
where u.userid == Convert.ToInt32(Session["ChatUserID"])
&& u.roomid == Convert.ToInt32(lblRoomId.Text)
select u).SingleOrDefault();
if (user == null)
{
Logged_In_User loggedInUser = new Logged_In_User();
loggedInUser.userid = Convert.ToInt32(Session["ChatUserID"]);
loggedInUser.roomid = Convert.ToInt32(lblRoomId.Text);
db.Logged_In_Users.InsertOnSubmit(loggedInUser);
db.SubmitChanges();
}
string userIcon;
StringBuilder sb = new StringBuilder();
var loggedInUsers = from l in db.Logged_In_Users
where l.roomid == Convert.ToInt32(lblRoomId.Text)
select l;
foreach (var loggedInUser in loggedInUsers)
{
if (loggedInUser.User.gender.ToString().ToLower() == "m")
userIcon = "<img src='Images/manIcon.gif' style='vertical-align:middle' alt=''> ";
else
userIcon = "<img src='Images/womanIcon.gif' style='vertical-align:middle' alt=''> ";
if (loggedInUser.User.username != (string)Session["ChatUsername"])
sb.Append(userIcon + "<a href=#>" + loggedInUser.User.username + "</a><br>");
else
sb.Append(userIcon + "<b>" + loggedInUser.User.username + "</b><br>");
}
litUsers.Text = sb.ToString();
}
private void GetMessages()
{
var messages = (from m in db.Messages
where m.roomid == Convert.ToInt32(lblRoomId.Text)
orderby m.timestamp descending
select m).Take(20).OrderBy(m => m.timestamp);
if (messages != null)
{
StringBuilder sb = new StringBuilder();
int ctr = 0;
foreach (var message in messages)
{
if (ctr == 0)
{
sb.Append("<div style='padding: 10px;'>");
ctr = 1;
}
else
{
sb.Append("<div style='background-color: #EFEFEF; padding: 10px;'>");
ctr = 0;
}
if (message.User.gender.ToString().ToLower() == "m")
sb.Append("<img src='Images/manIcon.gif' style='vertical-align:middle' alt=''> " + message.text + "</div>");
else
sb.Append("<img src='Images/womanIcon.gif' style='vertical-align:middle' alt=''> " + message.text + "</div>");
}
litMessages.Text = sb.ToString();
}
}
public void BtnLogOut_Click(object sender, EventArgs e)
{
var loggedInUser = (from l in db.Logged_In_Users
where l.userid == Convert.ToInt32(Session["ChatUserID"])
&& l.roomid == Convert.ToInt32(lblRoomId.Text)
select l).SingleOrDefault();
db.Logged_In_Users.DeleteOnSubmit(loggedInUser);
db.SubmitChanges();
this.InsertMessage("Just logged out! " + DateTime.Now.ToString());
Session.RemoveAll();
Session.Abandon();
Response.Redirect("Default.aspx");
}
#region ICallbackEventHandler Members
string System.Web.UI.ICallbackEventHandler.GetCallbackResult()
{
return _callBackStatus;
}
void System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
_callBackStatus = "failed";
var loggedInUser = (from l in db.Logged_In_Users
where l.userid == Convert.ToInt32(Session["ChatUserID"])
&& l.roomid == Convert.ToInt32(lblRoomId.Text)
select l).SingleOrDefault();
db.Logged_In_Users.DeleteOnSubmit(loggedInUser);
db.SubmitChanges();
this.InsertMessage("Just logged out! " + DateTime.Now.ToString());
_callBackStatus = "success";
}
#endregion*/
}
}
|
|
|
|
|
Firstly, there is far too much unnecessary code in your post. Most will just ignore a post like this, not wanting to read through pages of code. State the problem you are having and only post the bit relevant to it. And don't say all of this is relevant, it isn't.
It isn't the inherits tag that is the issue. As it says in the error message your class must be derived from ViewPage, ViewUserControl, or a variant of them.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hai ,
i am the begineer in web development,shall i know how to develope the web page more attractive,i mean what are the combination of colors
we use to backgroud color ,and font color and botton , is there any combination's there? give ur advice and suggesstion's
Thank You....
|
|
|
|
|
fak.kumar wrote: we use to backgroud color ,and font color and botton , is there any combination's there?
Use Free Web Templates They are easy to Use..!
http://lmgtfy.com/?q=Free+Website+Templates[^]
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi
I am implementing a discussion board as a phase of my project. When we visit a web site to see replies of a thread, the url of the page is something like http://forums.asp.net/t/1335371.aspx. Could anybody please let me know, what is the meaning of number 1335371 and how it is generated. and please give me a reference to learn more about that kind of website implementation.
Thank You....
|
|
|
|
|
That number probably an id of the thread in the database. You can create such links using url rewriting. There are many articles in web about url rewriting.
MSDN[^]
|
|
|
|
|
Hello,
I would like to know if there is anybody interested in building a P3P framework for ASP.NET.
I read many articles about P3P in ASP.NET dealing with "brute" hardcoded headers sent to the client.
Everyone can do this. However, since P3P is sees by many experts as a key framework in Web 2.0, as privacy becomes an always greater concern for users, I was interested in implementing the whole P3P framework into ASP.NET so anyone can build his custom privacy policy with easy configuration steps, ie. by just editing Web.config and adding proper nodes for P3P, which will result in the generation of correct headers.
I don't have a complete knowledge of the P3P model as defined by W3C, so I was wishing to reunite a group of people who are interested in building a complete open source solution to allow developers using P3P in seconds.
The project could also be ported to Java/JSP in the near future.
I am a 2nd level grade Computer Engineer studend and I'm experienced in C#, VB and ASP.NET.
Thank you for your attention.
|
|
|
|
|
Hi! I am doing a new install of visual studio 2002 enterprise architect. am using xp home with sp3. I have my install discs for Exchange Server 2000,Host Intewgration Server 2000,sql server 2000,Windows 2000 server..all these came with the Visual Studio 2002. The whole idea is to get IIS installed so I can use ASP.Net. Which of these programs install IIS? or should I install IIS as a stand alone app? I also have the microsoft express web development platfrom..may I should port to that? What should I do?
Thanks
andy
|
|
|
|
|
andrew p jones wrote: Which of these programs install IIS
None. It's part of XP Pro, but you need the CD to install it, it's not installed by default. It does not come with XP Home, at all.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I have a TreeView control defined on my page. All works well apart from the fact that the list of nodes it contains extends beyond the bottom boundary of the control so I've wrapped the control in a DIV which adds scroll bars.
I can scroll to the bottom of the TreeView and select a node; but unfortunately, the TreeView then scrolls to the top automatically and this means that I can no longer see the node I selected unless I then scroll back down to it.
Can anyone tell me how I can prevent this from happening?
Thanks
|
|
|
|
|
Actually the scroller goes to the top because a postback of the page is just been made.
|
|
|
|
|
|
I have a web form that uses the Telerik RadAjaxManager (via RadAjaxManager proxy) to update a RadGrid based on filter criteria. When the criteria change, I rebind the grid, but now I also want to resize the grid on the client, using JavaScript. How can I cause my JavaScript to be executed when I rebind the grid? The JS code already exists on the page, and just needs to be called.
E.g. When I increase the number of rows in the RadGrid, it reverts to a default height, much less that the height of its container, until I resize or reload the page, when the grid is sized by the code below. I want to be able to execute resizeChildren() when my criteria, and thus the number of rows, changes.
function resizeChildren() {
$("#ctl00_mainContentPlaceHolder_grid_GridData").height($(window).height() - 160);
}
$(document).ready(function() {
resizeChildren();
});
$(window).resize(function() {
resizeChildren();
});
|
|
|
|
|
You need to hack into the js that the controls generate, and inject your code into it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Why dont you call resizeChildren yourself then after RadGrid increases thee no of rows. Just call the function yourself when you receive the callback from the server rather than depending on Browser resize.
|
|
|
|
|
Hello
Does anybody know how to programmatically add text message,the period the status will be out of office in out-of-office auto-responder in Outlook 2007?
I am able to change the status but not able to add text message.
Thanks in advance......
|
|
|
|
|
Manprit.bagga wrote: Does anybody know how to programmatically add text message,the period the status will be out of office in out-of-office auto-responder in Outlook 2007?
Manprit.bagga wrote: I am able to change the status but not able to add text message.
How are you doing this using ASP.NET ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Currently the code i am working on is for window based ,I will be putting the code in javascript file and with the help of active-x i will be using in asp.net project.
Currently with this code i am able to change the status of out of office ,now i am looking for whether we can change the text message and can add rule.
bool OOFState;
string message;
Microsoft.Office.Interop.Outlook.ApplicationClass app = new
Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.NameSpaceClass ns =
(Microsoft.Office.Interop.Outlook.NameSpaceClass)app.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.Recipient recipient = ns.CreateRecipient("Manprit");
Microsoft.Office.Interop.Outlook.MAPIFolder Inbox = ns.GetSharedDefaultFolder(recipient, Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
Microsoft.Office.Interop.Outlook.PropertyAccessor pa = Inbox.PropertyAccessor;
foreach (Microsoft.Office.Interop.Outlook.Store store in ns.Stores)
{
if (store.ExchangeStoreType == Microsoft.Office.Interop.Outlook.OlExchangeStoreType.olPrimaryExchangeMailbox)
store.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x661D000B", true);
}
}
}
|
|
|
|
|
Did you ever get a response or find out an answer to this? I'm actually trying to do the exact same thing and am having difficulty finding a solution anywhere.
Dave
|
|
|
|
|
hi,
to All..
i want to create chat application in asp.net, please suggest me how can i start. give me reference URL also.
Amit
i like to play with programming....
|
|
|
|
|
See this :
Simple Chat Application in ASP.NET[^]
Actually the concept is each client will update the server using AJAX, so that once server is updated, the other person gets notified.
|
|
|
|