|
Hai,
thanks for the reply, i am getting the text value with your Suggestion.
but i have to code in javascript to populate the combobox.
|
|
|
|
|
rakeshs312 wrote: but i have to code in javascript to populate the combobox.
So there are two ways... either you hard code your values in the dropdownlist or use
AJAX to read the xml file and then fill the data fetched in you dropdown.
this[^] might help you.
When you fail to plan, you are planning to fail.
|
|
|
|
|
hi people
I've created this session in global.asax part of my project in this way:
Session["news_id"]= null;
I've used a datalist to load some news titles from database and when you click on that title (Which is a link button) there opens a popup window and reads the desired news.
It the click event of mentioned link button I've told that:
Session["news_id"]= (int)(dataList1.DataKeys[dataList1.SelectedIndex]);
(I guess that the snippet above is problmatic)
Then in the form_load of that popup page after creating the sqlconnection stuff i've made the below commandtext:
"select text from news where id='"+Session["news_id"]+"'";
in which text is a field that news is stored and news is the name of my table.
What I get as an error is that sometimes on the click event of my link button says : Object not set to its refrence or something and sometimes it says that index was out of range!
Plase help me with you solutions.
Thanks alot
Proper Prepration Prevents Poor Performance! h
|
|
|
|
|
You are right, i also think the problem with
Session["news_id"]= (int)(dataList1.DataKeys[dataList1.SelectedIndex]);
First, dataList1.SelectedIndex is start with 0 and i think news_id is start with 1 (Its my guess).
This index of control never be similar with your id. you can use response.write to check this problem...
You can also use the similar type of things....
<asp:datalist id="DataList1" runat="server" backcolor="White" bordercolor="#E7E7FF" xmlns:asp="#unknown">
BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyField="id" DataMember="DefaultView"
DataSourceID="SqlDataSource1" GridLines="Horizontal" UseAccessibleHeader="True"
Width="100px">
<itemtemplate>
]]>
]]>
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:ConnectionString %>" xmlns:asp="#unknown">
SelectCommand="SELECT [id], [title], [name] FROM [table]">
Here you pass news id as query string.
The miracle is this--the more we share, the more we have.
|
|
|
|
|
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.
|
|
|
|