|
As a matter of fact the result of return is always -1 ! I don't know why.
by the way Do you think I can try the title instead of id?
I mean I use the string of title to pass to session and ...
by the way, since I am kind of new in asp.net please inlight me with the ways you've provided. I have no idea what I should do with them
thanks
Proper Prepration Prevents Poor Performance! h
|
|
|
|
|
You can pass anything instead of id which is unique (because every link open a unique page.). you can use javascript window.open() function also to open in pop up.
In pop up page you receive the id/title value and based on that value you can show the content in the pop up.
The miracle is this--the more we share, the more we have.
|
|
|
|
|
I have a textbox for entering password. After finish entering,If i press the "Enter" button the login validation will be triggered? How is it possible?
|
|
|
|
|
you may use a JS function which will be triggered on key press. When handling the OnKeyPress event, you need to check if the pressed key is Enter , if yes, you need to call btnLogin.Click(); (btnLoginId is passed as a function parameter)
onkeypress="return Login(event, 'btnLogin')"
function Login(e, btnLoginId)
{
var evt = e ? e : window.event;
var btnLogin = document.getElementById(btnLoginId);
if (btnLogin)
{
if (evt.keyCode == 13){
btnLogin.click();
return false;
}
}
}
Calin
|
|
|
|
|
Set Defaultbutton property of the form like below....
<asp:button id="SubmitButton" runat="server" text="Submit" xmlns:asp="#unknown">
The miracle is this--the more we share, the more we have.
|
|
|
|
|
hi all,
how to implement ReOrderList ajax control in my web page without binding to any datasource. I need to bind only from my code by using dataset.
Also i ve to do drag drop option in it...
Ashok
|
|
|
|
|
How to add node one to another tree view on click of bottom?
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Use below code like this....
Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitButton.Click
Dim treenode As New TreeNode()
Dim secondnode As New TreeNode()
treenode.Text = "This is first node"
secondnode.Text = "This is sub node."
treenode.ChildNodes.Add(secondnode)
TreeView1.Nodes.Add(treenode)
End Sub
The miracle is this--the more we share, the more we have.
|
|
|
|
|
Thanks For reply...
I do not want this things.. there are two tree view .i want click on treeview1 node and copy through bottom click in treeview2 at same label.
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
USE This:
In html:
<asp:treeview id="TreeView1" runat="server" xmlns:asp="#unknown">
<nodes>
<asp:treenode showcheckbox="True" text="Node1" value="Node1">
<asp:treenode showcheckbox="True" text="Node2" value="sub Node">
<asp:treenode showcheckbox="True" text="Node3" value="Node3">
<asp:treeview id="TreeView2" runat="server" xmlns:asp="#unknown">
<asp:button id="SubmitButton" runat="server" text="Submit" xmlns:asp="#unknown">
In code behind:
For Each node As TreeNode In TreeView1.CheckedNodes
Dim treenode As New TreeNode()
treenode.Text = node.Text
Me.TreeView2.Nodes.Add(treenode)
Next
The miracle is this--the more we share, the more we have.
|
|
|
|
|
In my project , i've a page to b used by users who logs in successfully ,but after he logs out he shud not c the previous pages ven he clicks Back Button in the Browser?
Plz help.
|
|
|
|
|
After login u will get one page ,in that page try this
private void Page_Load(object sender, System.EventArgs e)
{
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
}
|
|
|
|
|
|
Hai,
It is working perfectly in 2.0 where did u paste the code?
after the login page ,u will get a page ,in that page ,inside the pageload event just paste this code
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
|
|
|
|
|
The error came like these when click on the back button.
"Use the new keyword to create an object instance.
Check to determine if the objects is null before calling the method."
|
|
|
|
|
try this eg:
username and password is admin
Default.aspx
]]>
<title>Untitled Page
<asp:textbox id="TextBox1" runat="server" style="z-index: 100; left: 453px; position: absolute;<br mode=" hold=" /> top: 93px" xmlns:asp="#unknown">
<asp:textbox id="TextBox2" runat="server" style="z-index: 101; left: 462px; position: absolute;<br mode=" hold=" /> top: 158px" textmode="Password" xmlns:asp="#unknown">
<asp:button id="Button1" runat="server" onclick="Button1_Click" style="z-index: 102;<br mode=" hold=" /> left: 514px; position: absolute; top: 250px" text="Button" xmlns:asp="#unknown">
<asp:label id="Label1" runat="server" style="z-index: 104; left: 323px; position: absolute;<br mode=" hold=" /> top: 97px" text="Enter the username" xmlns:asp="#unknown">
<asp:label id="Label2" runat="server" style="z-index: 104; left: 327px; position: absolute;<br mode=" hold=" /> top: 158px" text=" Enter the password" xmlns:asp="#unknown">
Default2.aspx
]]>
<title>Untitled Page
<asp:label id="Label1" runat="server" font-bold="True" font-size="XX-Large" forecolor="Red" xmlns:asp="#unknown">
Height="86px" Style="z-index: 100; left: 239px; position: absolute; top: 26px"
Text="Welcome" Width="295px">
<asp:linkbutton id="LinkButton1" runat="server" onclick="LinkButton1_Click" style="z-index: 102;<br mode=" hold=" /> left: 637px; position: absolute; top: 26px" xmlns:asp="#unknown">Logout
Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Focus();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "admin" && TextBox2.Text == "admin")
{
Server.Transfer("Default2.aspx");
}
else
{
Response.Write("Wrong username or password");
}
}
}
Default2.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Session.Abandon();
Server.Transfer("Default.aspx");
}
}
|
|
|
|
|
|
Is it possible to create a Frameset in Visual studio 2005? How?
|
|
|
|
|
Because frames are not fully supported by the w3c, it is not implemented in Asp.net 2.0. You can implement it only throw editing in the source view.
you can also create the HtmlGenericControl object that will eventually render as an iframe and specify whatever attributes this iframe will have:
// Create new iframe control
HtmlGenericControl searchFrame = new HtmlGenericControl("iframe");
searchFrame.ID = "searchFrame";
searchFrame.Attributes.Add("class", "searchFrame");
searchFrame.Attributes.Add("frameborder", "0");
Then, I can add it to the PlaceHolder’s controls collection:
// Add it to the Controls collection of the PlaceHolder control
searchHolder.Controls.Add(searchFrame);
Finally, I add the PlaceHolder control into my ascx document where I’d like the iframe to eventually be:
<div class="searchContainer">
<asp:PlaceHolder id="searchHolder" runat="server" />
</div>
Now, an iframe will appear in the outputted HTML code where the placeholder once was.
The similar type of things can be implemented ASP.NET2.0 by "Master Page"
The miracle is this--the more we share, the more we have.
|
|
|
|
|
which method is more appropriate for use with XML?
-> xmlDocument
-> xPathDocumrnt
-> Datatset
|
|
|
|
|
Depends on what you want to achieve. For navigation within an XML the best choice will be xpath I think. XmlDocument could be also nice but you only have this navigation like direct child/parents etc. DataSet is better when trying to use XML like a database.
By the way, this is not your homework, is it?
Regards
Sebastian
P.S.: Heard that XPath will is slow... maybe this will affect your choice.
|
|
|
|
|
I have developed a chat application.
i am displaying chat messages using gridview in a div.I am using gridview in update panel(ajax).With every timer_tick I update the gridview.My timer control s in control template of update panel.The problem is I have to maintain the scroll position after after timer tick event ie after the grid gets the data.
I ahve altried all the options on the net.None of them is working.Help me Its urgent.
This problem is buggin me alot.
Here is the code .aspx
]]>
<title>Welcome to chat application
<%----%>
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown">
<asp:updatepanel id="UpdatePanel1" runat="server" xmlns:asp="#unknown">
<contenttemplate>
<asp:gridview showheader="false" width="1%" cellpadding="0" cellspacing="0" id="gvmsg" gridlines="None" runat="Server" autogeneratecolumns="false">
<columns> <asp:templatefield>
<itemtemplate>
]]> | <%-- <asp:label id="lblchtmsg" width="230px" runat="server" text="<%#Eval(" chat_msgs")%>"=""> --%>
<%#Eval("Chat_msgs")%>
|
<rowstyle backcolor="WhiteSmoke">
<alternatingrowstyle backcolor="#E0E0E0">
|
<asp:timer id="Timer1" runat="server" interval="200" ontick="Timer1_Tick" enabled="True">
<%--<asp:timer id="Timer2" runat="server" ontick="Timer2_Tick" enabled="False" interval="200">
--%>
here is the .cs code
public partial class showmsg : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void asUser()
{
string cnt = dbFunctions.getSingleRecord ("select count(*) from ChatMsgs where Chat_id='" + Session["chatid"].ToString()+"'");
if (int.Parse(cnt) > 10)
lbtncomplete.Visible = true;
// DataTable dt = dbFunctions.getTable("select * from ChatMsgs where Chat_id='" + Session["chatid"].ToString() + "' ORDER BY ID ASC");
DataTable dt = dbFunctions.getTable("select * from ChatMsgs where ID in(select TOP 11 ID from ChatMsgs where Chat_id='" + Session["chatid"].ToString() + "' ORDER BY ID DESC) ");
gvmsg.DataSource = dt;
gvmsg.DataBind();
}
public void asAdmin()
{
DataTable dt = dbFunctions.getTable("select * from ChatMsgs where Chat_id='" + Session["chatid"].ToString() + "'");
// DataTable dt = dbFunctions.getTable("select * from ChatMsgs ORDER BY ID DESC ");
gvmsg.DataSource = dt;
gvmsg.DataBind();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
//if (Session["top10"].ToString() == "true")
//asUser();
asAdmin();
}
protected void lbtncomplete_Click(object sender, EventArgs e)
{
//Session["top10"] = "false";
DataTable dt = dbFunctions.getTable("select * from ChatMsgs where Chat_id='" + Session["chatid"].ToString() + "' ORDER BY ID ASC");
// DataTable dt = dbFunctions.getTable("select * from ChatMsgs ORDER BY ID DESC ");
gvmsg.DataSource = dt;
gvmsg.DataBind();
}
}
Please help its really urgent
Thanks in advance
|
|
|
|
|
Use this javascript code after the databind or just before the closing body tage.
var objDiv = document.getElementById("div1");
objDiv.scrollTop = objDiv.scrollHeight;
Use the original 'div id' in place of div1.
The miracle is this--the more we share, the more we have.
|
|
|
|
|
hey gaurav thanks for reply
i was waiting for a reply no body replied i guess its not such atough question
anywaz your solution is not working any other solutions.
i am fed up this problem
hopefuly some one can give a solution(s)
thanks in adavnce
|
|
|
|
|
oh...
It should work...Because it is tested in my porject.
For creating a scroll i used style="overflow:auto" in my div...
Try it again...
The miracle is this--the more we share, the more we have.
|
|
|
|