|
No that is happening because you are appending the items in the dropdown list control. First cleat all the items in the datalist and then add the items in the list.
Best Regards,
Apurva Kaushal
|
|
|
|
|
cmddiv = New SqlCommand("Select Divi_id from Division where Divi_Name='" & DivList.SelectedItem.Text & "'", dbConn)
num = cmddiv.ExecuteScalar()
cmddis = New SqlCommand("select Distname from District where Divi_id=" & num & "", dbConn)
dtrdist = cmddis.ExecuteReader()
While (dtrdist.Read())
DistList.Items.Add(dtrdist("Distname"))
End While
dtrdist.Close()
but this is when page is loaded,if we select a divison,it displays districts,again if i selct a division,it appends the new districts to the previous list,how to clear the list in the code.
kissy
|
|
|
|
|
I suppose this is the same code which you put in change event also. Any way before executing this part clear the items like this:
DistList.Items.Clear();
This should be the first statement.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Here for the first time when i select a state that will not display.Same happening in DIvision also.If i select second time all are working properly.so wat to do for this??? a
and i have a code like
Dim cnt As Integer
cmdcnt = New SqlCommand(" Select MAX(Centre_Id) from Division_District where District_Id='" & num & "'", dbConn)
cnt = cmdcnt.ExecuteScalar()
If cnt = 0 Then
cnt = 1
if max is null the nhow to compare that value with ordinary integer.Like Isdbnull() or something.
kissy
|
|
|
|
|
Check the autopost back property as rah_sin has said.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi all,
I need to set RSS 2.0 to my web site. can any body tell me that actually what is RSS 2.0 and why it used for? and How to set the RSS 2.0 to my site. if any body gives the solution in their words instead of providing links it would be appreciated. Thanks in advance
Thanks and Regards
Venkat
|
|
|
|
|
Dear venkatasivaramaprasad,
RSS stands for Rich Site Summary or Really Simple Syndication. It is designed to allow individuals to distribute news or articles in a format that is easy for programs to read i.e XML. This allows you to gather relevant content from other sites without needing to rewrite the content or update articles on your site. you can get RSS-Syndicated content from http://moreover.com
With regards,
Suresh Dayma
|
|
|
|
|
Can ne 1 tell me how do i bind datagrid to ajax function. there can i do the adding and deleting data in datagrid using ajax
|
|
|
|
|
please help...............
I have an asp page i have to include that page in my .net page when i include this page it throws an error on every line. i have set aspcombat=true but no effect can u suggest how can i include the asp page in .net page
|
|
|
|
|
You can use ASP and ASP.NET pages in the same application, but you can't mix ASP code and ASP.NET code in the same page.
You can use an iframe to display the ASP page.
---
b { font-weight: normal; }
|
|
|
|
|
Hi All
I have a detailsview in Insert Mode and want to populate the myID field on insert with a new index number.
What I am doing is checking the last index number and adding 1. Then I want to put this value in to the Detailsview myID field in read only so users can not change it.
I want this to happen on the Detailsview_Inserting event. See code below....
<br />
Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles DetailsView1.ItemInserted<br />
If DetailsView1.CurrentMode = FormViewMode.Insert Then<br />
LoadData()<br />
<br />
'Get max entry in table myID field.<br />
<br />
'Increment by one.<br />
<br />
'Add to the myID field in the dateview.<br />
<br />
End If<br />
End Sub<br />
Private Sub LoadData()<br />
Dim oleConn As New OleDbConnection<br />
oleConn.ConnectionString = ConfigurationManager.ConnectionStrings("ShowRegDBConnectionString").ConnectionString<br />
<br />
Dim oleComm As New OleDb.OleDbCommand<br />
oleComm.Connection = oleConn<br />
<br />
Try<br />
oleConn.Open()<br />
<br />
oleComm.CommandText = ("SELECT Max(myID) FROM SuggestionTB")<br />
Dim myID As String = Convert.ToString(oleComm.ExecuteScalar())<br />
<br />
oleConn.Close()<br />
<br />
LastValue = myID<br />
<br />
Catch ex As OleDbException<br />
oleConn.Close()<br />
End Try<br />
End Sub<br />
Any ideas....
When people make you see red, be thankful your not colour blind.
|
|
|
|
|
I have four dropdownlists and a button on a page. all 4 of them get their data from database based on the selection of the dropdownlist before themselves. After the user selected all the dropdownlist, I will click the button, and a server side function will be called, then the same page should be displayed again with all the previous selection.
I DID use !IsPostBack on Page_Load, all the server controls are populated when !IsPostBack. However, after I clicked that button, only the first dropdownlist keeps its selection, the next three becomes blank. I even created a dummy button on the same form so that on clicking it nothing happens except PostBack, but same thing happened. Only first dropdown list keeps its selection. Why? how do I solve this?
|
|
|
|
|
Do all of the dropdowns use AutoPostBack? Are you populating them again during postback?
only two letters away from being an asset
|
|
|
|
|
Someone here thinks making the url more readable and hiding the technology we use is a priority and I need to do it.
So, I wrote an HttpModule that does some url rewriting, first if you have an address without an extension it gets that page plus .aspx. I.e. if you typed "http://www.mysite.com/users" into your address bar, users.aspx would be loaded (though the url would stay the same). This works fine. Also, this module will take pages with an extension written in, remove it, and refresh the page. For example, if you typed in "http://www.mysite.com/users.aspx" (or .cfm, php, etc) the module would parse the url, and do a Respone.Redirect to "http://www.mysite.com/users" where it is then processed as described above.
However, the problem comes in when I try to use the login control built into asp.net 2.0. After you click the log in button I get a 404 error on default.aspx in ~/. If I disable my HttpModule everything works fine. Anything wrong with what I have or is there something the login control does automatically that interferes with it? Like Server.Transfer?
Here is the code for the module:
using System;
using System.Collections.Generic;
using System.Web;
namespace BEAR.UrlRewriter
{
public class ExtensionWriter : IHttpModule
{
private HttpApplication application;
private List<string> ext;
public void Init(HttpApplication application)
{
string[] exten = { "asp", "aspx", "pl", "cfm", "php" };
this.ext = new List<string>();
foreach (string s in exten)
ext.Add(s);
this.application = application;
this.application.BeginRequest += new EventHandler(this.BeginRequestHandler);
}
protected virtual void BeginRequestHandler(object sender, EventArgs e)
{
string url = this.application.Request.Path;
string[] path = url.Split(new char[] { '/' });
string[] location = path[path.Length - 1].Split(new char[] { '?' });
string file = location[0];
string[] splitFile = file.Split(new char[] { '.' });
if (splitFile.Length == 1)
{
string newPath = string.Empty;
foreach (string s in path)
newPath += s + "/";
newPath += file + ".aspx";
if (this.application.Request.QueryString.HasKeys())
newPath += "?" + this.application.Request.QueryString.ToString();
this.application.Context.RewritePath(newPath);
}
else if(splitFile.Length > 1 && ext.Contains(splitFile[1]))
{
string newPath = string.Empty;
foreach (string s in path)
newPath += s + "/";
newPath += splitFile[0];
if (this.application.Request.QueryString.HasKeys())
newPath += "?" + this.application.Request.QueryString.ToString();
application.Response.Redirect(newPath.ToLower());
}
}
public void Dispose() { }
}
}
|
|
|
|
|
I am working with ASP.NET 2.0 and VS 2005 to implement a new functionality.The functionality is to simply warn the user through a popup window before a predefined time that Session is about to timout.The user has two choices, either to ignore the warning or to renew the Authentication.
I am creating FormsAuthenticationTicket to define the timeout interval as displayed below:
<br />
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate<br />
If Membership.ValidateUser(Login1.UserName, Login1.Password) Then<br />
Dim oTimeout As Integer = (Convert.ToInt32(ConfigurationManager.AppSettings("TotalTimeOut")) / 60)<br />
Dim ticket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _<br />
Login1.UserName, _<br />
DateTime.Now, _<br />
Date.Now.AddMinutes(oTimeout), _<br />
Login1.RememberMeSet(), _<br />
"", _<br />
FormsAuthentication.FormsCookiePath)<br />
<br />
' Encrypt the ticket.<br />
Dim encTicket As String = FormsAuthentication.Encrypt(ticket)<br />
<br />
' Create the cookie.<br />
Response.Cookies.Add(New HttpCookie(FormsAuthentication.FormsCookieName, encTicket))<br />
<br />
' Redirect back to original URL.<br />
Response.Redirect(FormsAuthentication.GetRedirectUrl(Login1.UserName, Login1.RememberMeSet()))<br />
<br />
<br />
End If<br />
End Sub<br />
I am displaying the Warning by using Page.IsClientScriptBlockRegistered to register a Javascript function that is called with windows.setinterval.
The problem I am facing is how to renew the Authentication.I tried to update the cookie expire date and it back to the cookiecollection but that didnt work:
<br />
authCookie As HttpCookie = Request.Cookies(FormsAuthentication.FormsCookieName)<br />
authCookie.Expires = DateTime.Now.AddMinutes(oTimeout)<br />
I've also tried to signout the user (FormsAuthentication.Signout) and recreate a new ticket and that didnt work either.
I really appreciate any help.
|
|
|
|
|
hi,
im developing a website in ASP.NET can anyone tell me how to import the swish file into ASP.NET code?
Insia
|
|
|
|
|
I have a web application that access SQL Server for all of it's data. It authenticates to SQL with a trusted connection using a special domain account that the web server is running under. The application uses impersonation to know who is doing stuff in the application. Everything stated above works fine.
I have since added a Web Service to the same application as a "backdoor" to get data from the database. When I invoke a method on the service, I get a general access denied like exception. The exception is often pointing to some random DLL in the ASP.NET temporary files. Through research on the internet, I have narrowed this problem to being some sort of "web service cannot access SQL" problem. I am just confused as to why the web forms part works fine but the service does not. It is worth noting that I am passing the credentials to the web service and that the web server resides on a different server than SQL
Thanks.
|
|
|
|
|
I have noticed that content file is used when we talk about asp .net code, and code-behind file when we talk about c# code.
but I don't understand what these two statments are actualy mean !
|
|
|
|
|
Code-Behind is a seperate file containing your VB/C# Code. This is held seperate from the ASP code.
ASP use to be code and html content all in one but .Net has chaned this...
I am very new to these concepts but found code behind is a great logical split from the ASP and the VB/C# code.
Hope this helps....
When people make you see red, be thankful your not colour blind.
|
|
|
|
|
I am pretty new to asp.net and I am teaching myself through books and other materials. I am having a problem that I don't know how to handle this. Here is my example. I want my users to be logged in to view certain content of my site. If the user clicks on a link without being logged on I want user to be redirected to my login.aspx and after the user logs in be directed to the link that they clicked on? Any have any sample code of how this works?
|
|
|
|
|
Hi,
cisco2103 wrote: I want my users to be logged in to view certain content of my site.
Step 1 : You can create a Session for each user.
cisco2103 wrote: If the user clicks on a link without being logged on I want user to be redirected to my login.aspx and after the user logs in be directed to the link that they clicked on?
All the links where you want to check whether a user is logged on or not, check the session already created in "Step 1". For this, you can create a common page which accepts a query string of a target link. All of your links will point to this page. This page will check whether an user is logged in or not. If yes it will redirect to the target link from the query string, else to the log in page.
The log in page will also accept a query string, denoting where the user should be redirected. When user logs in successfully, the ok button will redirect the user to the source from where session was expired or user tried to access without logging in.
Hope i am clear enough. As far as syntactical part, you can always get help on msdn library.
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Very old school and completely unnecessary in the age of .NET
only two letters away from being an asset
|
|
|
|
|
OK let me clarify and make sure I understand what you are saying. Instead of using a cookie I would be using a sessionid for each user. A sessionid is pretty much the same as a cookie except it expires when it leaves IE? For step I am following you some. SO on a pageload event for a click link or button I would have something like.
if sessionid.value is nothing
response.redirect("login.aspx")
endif
I am very confused on the second part of step two. Code Examples would be very helpful if you have any.
Thanks Terry
|
|
|
|
|
Don't be confused. This solution isn't worth pursuing when you have all of the plumbing provided by ASP.NET framework.
only two letters away from being an asset
|
|
|
|
|
All that you are asking to do is built in to APS.NET. Using the web.config file you set the security for the folders, granting or denying access to users or groups. When someone attempts to access a file within any of these folders the ASP.NET framework will redirect them to a login page (provided you have specified one) then redirect them on to the original link after they have sucessfully logged in.
only two letters away from being an asset
|
|
|
|