|
thanks very much m8
Adrian De Battista - Web Designer, Web Programmer, Software Programmer From Malta. My Website .. www.MaltaTrade.org
|
|
|
|
|
Hi
For your second question you can use javascript to complete the required task.
|
|
|
|
|
hii,
i placed the listbox control in the webform. and i added some code in the ListBox1_SelectedIndexChanged but the problem that when i select the different items in the list it doesn't infoke the methode and i tried to debuge it and i found that the selectedindex is always = -1
|
|
|
|
|
Did you set autopostback to true on the listbox?
Ben
|
|
|
|
|
i tried to set autopostback to true and works for the pre defined items in the collection in design mode but if in run time if i clear the listbox items and fill it in the run time using the .Add() method it give me selectedindex=-1
|
|
|
|
|
It sounds like in the page_load method you are populating the listbox. You need to have some code that checks for postback. Something like:
If (!IsPostBack)
{
}
Otherwise you are constantly re-loading your listbox everytime you postback to the web server not just the first page load.
Hope that helps.
Ben
|
|
|
|
|
dear kunnen
first thanks for replay.
i discovered the problem, the problem that i was clearing the list items and load the list in page load. so when i select the item the reload again then clear the list and this point the selectedindex goes -1 .
so i put a condition that let it clear the list only one time when the page open
thanks again
|
|
|
|
|
I've got a Wizard control on my page with 21 WizardSteps. Some of the steps contain ValidationGroups. Each step that needs validation has it's own ValidationGroup defined. Now what I need to do is dynamically set the ValidationGroup property for the Next and Previous buttons in my Wizard's StepNavigationTemplate . For some reason, my C# code behind does not "see" the buttons in my StepNavigationTemplate . For example, I want to code it this way:
btnNext.ValidationGroup = "contactinfo";
The above does not work - a build time error occurs. I have also tried:
Button btn = new Button();<br />
btn = (Button)this.FindControl("ctl00_ContentPlaceHolder1_Wizard_StepNavigationTemplateContainerID_btnNext");<br />
btnNext.ValidationGroup = "proofcontact";
as well as:
Button btn = new Button();<br />
btn = (Button)this.FindControl("btnNext");<br />
btnNext.ValidationGroup = "proofcontact";
in each of the previous two above sets of code the familiar exception "Object not set to an instance..." occurs at runtime.
Does anyone have a solution for this?
|
|
|
|
|
Ok, I found a solution though it's prbably not the best. I brute forced it into seaching the whole form for the correct control with this function:
<br />
private Control FindIt(Control inCtrl, String ctrlEnd)<br />
{<br />
<br />
foreach (Control Ctrl in inCtrl.Controls)<br />
{<br />
if (Ctrl.ID == ctrlEnd)<br />
{<br />
return Ctrl;<br />
}<br />
else<br />
{<br />
if (Ctrl.HasControls())<br />
{<br />
Control c = null;<br />
c = FindIt(Ctrl,ctrlEnd);<br />
<br />
if (!(c == null))<br />
{<br />
return c;<br />
}<br />
<br />
}<br />
}<br />
}<br />
<br />
return null;<br />
}<br />
So I call it like this in the next button click event:
<br />
if (Wizard.ActiveStepIndex == 16)<br />
{<br />
<br />
Button btn = new Button();<br />
btn = (Button)FindMyControl(this, "btnNext");<br />
<br />
if (!(btn == null))<br />
{ <br />
btn.ValidationGroup = "proofcontact";<br />
}<br />
<br />
}<br />
|
|
|
|
|
I am new to ASP.NET
I am working on something as example but get a connectionstring not initialize problem and can't solve it.
Any help?
Thanks
This is all the files i have web config file, default.aspx ,default.aspx.vb and class.vb
Web.Conf
*********
<configuration>
<connectionstrings>
<add name="ConnectionString" connectionstring="Dsn=Photobank;uid=adminphotobank;pwd=adminphotobank"
="" providername="System.Data.Odbc">
<appsettings>
<add key="photobankConnectionString" value="packet size=4096;user id=bank;data source=ODBC.SQL.photo;persist security info=False;initial catalog=bank;password=bank">
<system.web>
<compilation debug="true" strict="false" explicit="true">
<pages>
<namespaces>
<clear>
<add namespace="System">
<add namespace="System.Collections">
<add namespace="System.Collections.Specialized">
<add namespace="System.Configuration">
<add namespace="System.Text">
<add namespace="System.Text.RegularExpressions">
<add namespace="System.Web">
<add namespace="System.Web.Caching">
<add namespace="System.Web.SessionState">
<add namespace="System.Web.Security">
<add namespace="System.Web.Profile">
<add namespace="System.Web.UI">
<add namespace="System.Web.UI.WebControls">
<add namespace="System.Web.UI.WebControls.WebParts">
<add namespace="System.Web.UI.HtmlControls">
<authentication mode="Windows">
******************************************
default.aspx.vb
Imports System.IO
Imports System.IO.Path
Imports System.Web.UI.Page
Imports System.Data.DataSet
Imports System.Data.DataTable
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
#Region " Code généré par le Concepteur Web Form "
'Cet appel est requis par le Concepteur Web Form.
'<system.diagnostics.debuggerstepthrough()>
Private Sub InitializeComponent()
Me.oConn = New System.Data.SqlClient.SqlConnection
End Sub
Protected WithEvents cmdAdvancedSearch As System.Web.UI.WebControls.Button
Protected WithEvents oConn As SqlConnection
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'REMARQUE : la déclaration d'espace réservé suivante est requise par le Concepteur Web Form.
'Ne pas supprimer ou déplacer.
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN : cet appel de méthode est requis par le Concepteur Web Form
'Ne le modifiez pas en utilisant l'éditeur de code.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Placez ici le code utilisateur pour initialiser la page
If Not IsPostBack Then
ViewState("isQuickSearch") = True
FillddList("ddCategory")
End If
End Sub
Public Function FillddList(ByVal ddList As String)
Dim SQLQuery As String 'SQL to fetch Data
Dim FieldText, FieldValue As String 'Name of the columns to add as text and as values...
Dim HeaderItem As New ListItem
Dim SelectAllItem As New ListItem
SQLQuery = ""
FieldText = ""
FieldValue = ""
Select Case ddList
Case "ddCategory"
SQLQuery = "SELECT * FROM CATEGORY ORDER BY " & "DESC E"
FieldText = "DESC E"
FieldValue = "DESC E"
HeaderItem.Value = ""
HeaderItem.Text = "Select a category"
SelectAllItem.Value = ""
SelectAllItem.Text = "All categories"
End Select
Dim Data As SqlDataAdapter = New SqlDataAdapter(SQLQuery, oConn)
Dim Odata As New Data.DataSet()
Data.Fill(Odata) // MY ERROR IS ON THIS LINE: CONNECTION STRING NOT INITIALIZE
Dim xrd As DropDownList = CType(Me.FindControl(ddList), DropDownList)
xrd.DataSource = Odata
xrd.DataTextField = Odata.Tables.Item(0).Columns(FieldText).ToString
xrd.DataValueField = Odata.Tables.Item(0).Columns(FieldValue).ToString
xrd.DataBind()
If SelectAllItem.Text <> "" Then
xrd.Items.Insert(0, SelectAllItem)
End If
If HeaderItem.Text <> "" Then
xrd.Items.Insert(0, HeaderItem)
End If
End Function
End Class
************************************************
default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<title>Untitled Page
This is a test
<asp:dropdownlist id="DropDownList1" runat="server" datasourceid="SqlDataSource1"
="" datatextfield="CTGY ID" datavaluefield="DESC E">
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:ConnectionString %>"
="" providername="<%$ ConnectionStrings:ConnectionString.ProviderName %>" selectcommand="SELECT * FROM [ CATEGORY]">
*****************************************
Thanks,
Musigati
|
|
|
|
|
No Need to Post all your files only post what you want to do and Where is the error And post only code which is showing error
PLease put the code in the code foramt given while posting any code
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Sorry for that.The problem is in the codefile and this stopping me to run the application.
The error is in the aspx.vb code and here is the code: When run the application i got this one:" DArd.Fill(DSrd)--->connectionstring not initialized--<" which means that Dsrd has to be initialized somewhere.The following is the code:
Imports System.IO
Imports System.IO.Path
Imports System.Web.UI.Page
Imports System.Data.DataSet
Imports System.Data.DataTable
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Public Function FillddList(ByVal ddList As String)
Dim SQLQuery As String 'SQL to fetch Data
Dim FieldText, FieldValue As String 'Name of the columns to add as text and as values...
Dim HeaderItem As New ListItem
Dim SelectAllItem As New ListItem
SQLQuery = ""
FieldText = ""
FieldValue = ""
Select Case ddList
Case "ddCategory"
SQLQuery = "SELECT * FROM PHOTOBANK TBL CATEGORY(dbo) ORDER BY " & "DESC E"
FieldText = "DESC E"
FieldValue = "DESC E"
HeaderItem.Value = ""
HeaderItem.Text = "Select a category"
SelectAllItem.Value = ""
SelectAllItem.Text = "All categories"
End Select
Dim DArd As SqlDataAdapter = New SqlDataAdapter(SQLQuery, oConn)
Dim DSrd As New Data.DataSet()
DArd.Fill(DSrd)
Dim xrd As DropDownList = CType(Me.FindControl(ddList), DropDownList)
xrd.DataSource = DSrd
xrd.DataTextField = DSrd.Tables.Item(0).Columns(FieldText).ToString
xrd.DataValueField = DSrd.Tables.Item(0).Columns(FieldValue).ToString
xrd.DataBind()
If SelectAllItem.Text <> "" Then
xrd.Items.Insert(0, SelectAllItem)
End If
If HeaderItem.Text <> "" Then
xrd.Items.Insert(0, HeaderItem)
End If
End Function
End Class
|
|
|
|
|
Hi everybody,
Does anyone know a way to force the number of lines in a label control.
For example I don't want the number of lines to exceed 4 lines & if the text is longer than that,it gets cut (cuz actually the label is inside a datagrid & I don't want the text to increase & scrolls to appear)
Thanks aloot
|
|
|
|
|
Sometimes I use a textbox that is set to multiline and change its appearance and make it read only. That way you also get a scroll bar if you go over the lines you want to show.
Hope that helps.
Ben
|
|
|
|
|
Hi,
For the past half an hour i was struggling with IIS6 trying to force all incoming requests to be handled by asp.net (aspnet_isapi.dll). In IIS5, you had to open IIS manager and from website properties select "Home directory/Configuration/Mapping" add a new extension * and point to : C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll
According to help topic it should be the same for IIS6, but when i tried to put * or .* it didn't accept it , and all what i was getting is an error "Wrong extension format".
After almost half an hour i finally figured out that it shoud be added in a bit different way:
from website properties select "Home directory/Configuration/Mapping" and choose Insert instead of Add, under "Executable" enter path to aspnet_isapi.dll
and uncheck "Verify that file exists", otherwise it wont work for folders. Unfortunately this also doesnt help.
In Microsoft's support site (http://support.microsoft.com/kb/326965/en-us) they say to update the existing list of MIME types. I did that also, but unfortunately this also does not solve the problem.
Please help me out if you have any solution.
You can reach me at vishvesh888@hotmail.com or vishveshraiter@gmail.com
Thanks
Vishvesh Raiter
|
|
|
|
|
Which is your server version ? Under Windows Server 2003: .* is not allowed in the mapping , there is an extra ‘all extensions’ section where you can add the aspnet_isapi.dll. Check This[^] aricle
|
|
|
|
|
Thanks for your quick reply. But the link which you pointed tells all about the Mapping in IIS5.1. I am using Windows 2K3 IIS6.0.
Please do reply.
Thanx
|
|
|
|
|
Hi fellas..
I am creating an application. And for that i want to create a website. But i am lil confused as at the moment i dont know asp.net or dream weaver or anything. Basically i never created website. I am software developer student.
The site would be simple advertisment of ma application and also there gonna be a forum section.
Do you require database for forums. I guess you do. So i guess best option would be asp.net.
Please guide me the right path so that i could get started.
Thanks
|
|
|
|
|
|
hi there,
i am just learning asp.net myself and from what i have gatered so far, you do not need a database to create a basic blogging forum..
if you want people to sign up to your site, you will need database connectivity..
i would recommend that you use asp.net for this task, and the best way for somebody with little experience is to get hold of visual studio..
i believe visual studio 2005 express edition is available for free on the microsoft website
http://msdn.microsoft.com/
along with free versions of SQL Server Express 2005 if you should decide that you do want to use a database..
the other fantastic thing about the msdn website is that there are literally hours of tutorials on visual studio, asp.net and sql server..
its a fantastic resource.. just go to the site and search for any of the above mentioned items.
ps. they also provide several free asp.net templates for sites, which can again be useful if webdesign is not your strong point, as it should help you bang up a nice site..
good luck...
John Michael Kinsella
kinsellajohn@hotmail.com
|
|
|
|
|
you could try something like dotnetnuke if you want a content driven website. or phpbb if you are just looking to setup a forum. You could produce a few simple pages in asp.net and include a phpbb forum in the pages.
Russ
|
|
|
|
|
Hi,
I have a small program which adds button on the IE toolbar,
i want to show an popup/window exactly below the button in every condition
(window resize).
any help, link is greatly appreciated.
thanks in advance.
amolk
amolk
|
|
|
|
|
aamn1 wrote: I have a small program which adds button on the IE toolbar,
Did you add button to the toolbar ?
aamn1 wrote: i want to show an popup/window exactly below the button in every condition
(window resize).
any help, link is greatly appreciated.
Actually what is your requirement ?
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Hello everyone,
I am trying to change styles of some client-side objects dynamically.
For example whenever the user is at the mainPage.aspx, the text between <div id="activeMainPage">blablabla</div> should be bold.
My problem is : how can I get the current page, and how can I change the text's style dynamically ?
BTW, I am a really newbie in ASP.Net.
Thanks for your helps and best regards.
.:: Something is Wrong ::.
|
|
|
|
|
Hello,
You can use CSSclass.
|
|
|
|