|
All The Best Sir !!!
cheers,
Abhijit
|
|
|
|
|
Hi,
My Listbox control works fine, at design and run-time. One minor bug (if I can call it that way) is that the ListItems aren't displayed inside the control as the original Listbox does at design time. The collection works fine and they are shown at run-time fine too.
I'm posting some code I think it's important, if you find usefull, I'll post the whole Listbox code.
Just one more thing: I don't want the "Selected" property be available at design time. I tried [EditorBrowsable(EditorBrowsableState.Never)] but it didn't do anything.
ListBox:
public class ListBox : System.Web.UI.WebControls.WebControl
{
private ListItemDataCollection listData = null;
public ListItemDataCollection ListItems
{
get
{
if (listData == null)
{
listData = new ListItemDataCollection();
}
return listData;
}
}
protected override void Render(HtmlTextWriter output)
{
if (Rows > 1)
{
output.AddAttribute(HtmlTextWriterAttribute.Size, Rows.ToString());
if (MultipleSelections)
output.AddAttribute(HtmlTextWriterAttribute.Multiple, true.ToString());
}
base.Render(output);
}
protected override void CreateChildControls()
{
Controls.Clear();
for (int i =0; i < ListItems.Count; i++)
{
Controls.Add(ListItems[i]);
}
}
public override ControlCollection Controls
{
get
{
EnsureChildControls();
return base.Controls;
}
}
}
ListItem:
[ToolboxItem(false),
ToolboxData("<{0}:ListItem runat=server>"),
TypeConverter(typeof(ExpandableObjectConverter))]
public class ListItem : System.Web.UI.Control
{
public ListItem(string text, string value)
: base()
{
Text = text;
Value = value;
}
public ListItem() { }
public ListItem(string text, string value, bool selected)
: this(text, value)
{
Selected = selected;
}
#endregion
public string Text
{
get
{
object text = ViewState["Text"];
if (text == null)
return string.Empty;
return (string)text;
}
set
{
ViewState["Text"] = value;
}
}
public string Value
{
get
{
object value = ViewState["Value"];
if (value == null)
return string.Empty;
return (string)value;
}
set
{
ViewState["Value"] = value;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public bool Selected
{
get
{
object selected = ViewState["Selected"];
if (selected == null)
return false;
return (bool)selected;
}
set
{
ViewState["Selected"] = value;
}
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.AddAttribute(HtmlTextWriterAttribute.Value, Value);
if (Selected)
writer.AddAttribute(HtmlTextWriterAttribute.Selected, true.ToString());
writer.RenderBeginTag(HtmlTextWriterTag.Option);
writer.Write(Text);
writer.RenderEndTag();
}
}
public sealed class ListItemDataCollection : List<listitem>{}
</listitem>
Thanks,
Dirso
|
|
|
|
|
I am working on an asp.net application. I have a class file, in which I want to get physical path (location) of the file (on which I am working on) at runt time.....
Path can be something like "D:/Projects/myweb/"
Remember, I cannot use server.mappath() because it is not an aspx file, rather a simple class (.cs) file.
|
|
|
|
|
I don't think you can do this - the .cs file will be compiled into a DLL which is wouldn't contain the actual file reference. Since a DLL is portable, having a reference to where the file was developed wouldn't make any real sense.
It definitely isn't definatley
|
|
|
|
|
Add name space "System.web" in your class file..
Get application path by following line of code:
string applicationpath = HttpContext.Current.Server.MapPath("");
|
|
|
|
|
yasir1024 wrote: Server.MapPath("");
But you said you could not use Server.MapPath() already.
|
|
|
|
|
Try using Environment class
|
|
|
|
|
i m downloading aspx page content in form of excel but to add worksheets in excel i have to use microsoft.office11.0 obect library com component i can use in local but how can i use this refrence in live
|
|
|
|
|
|
My Question is how can we access DataTable events inside a Dataset in ASP.NET because I can't access the Partial Class for writing logic for RowChanging or RowChanged events. Thanks in advance !
AliAmjad
First make it Run THEN make it Run Fast!
|
|
|
|
|
You can access the DataTable as a property of the DataSet and then refer to the events from there so you should be able to subscribe to the event dataset.Tables[0].RowChanged
It definitely isn't definatley
|
|
|
|
|
Thank you buddy for your response and putting me in the right direction
AliAmjad(MCP)
First make it Run THEN make it Run Fast!
|
|
|
|
|
hello,
Can i create a web application setup or project using installshiled12.
(i have to install also a database and ...).
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
ellllllllie wrote: Can i create a web application setup
Yes you can Create a Web SetUp Project .
Have a look[^]
cheers,
Abhijit
|
|
|
|
|
Hi Experts,
I have a web site in ASP.Net with Sql Server 2000 as DB. My problem is that the web application is not allowing concurrent logins to it. Once a user logs into the site starts some process, the database get locked and other user can not get access to the site. For the first user it works fine but other concurrent connections it gives me following error message:
"{"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interface..."<br />
I don't know whats the reason for this. I think I am missing some settings in my server.
I have used following connection string
"Data Source=MyServer; Initial Catalog=MyDb; User ID=un; Password=123456; MultipleActiveResultSets=True; pooling=true"<br />
Can anyone help me out. Its very urgent.
__________________
Regards,
Paramhans Dubey.
|
|
|
|
|
Check you code . Are you using Conn.Dispose() any where of your application ?
cheers,
Abhijit
|
|
|
|
|
Hi Abhijit,
Thanx For your reply. answer is No. I have not used Conn.dispose() anywhere in my code.
|
|
|
|
|
I think This[^] link will may help you out .
cheers,
Abhijit
|
|
|
|
|
Have you looked to see if anything is locked in your database after the first user has logged in?
|
|
|
|
|
Are you able to connect to the DB server via Query analyzer or through remote desktop.
Think you dont have rights to connect to the server.
|
|
|
|
|
Yes i am able to connect to database using query analyzer.
|
|
|
|
|
Then the problem is in the transaction that you are using.
Where is the transaction being controlled ? is it in the business layer or at the SQL level ?
Have you closed all the transactions properly ?
Have a look at the activity monitor, filter by the database and check.
|
|
|
|
|
1, How fill CheckBox
2, CheckBox value get it from database
3, as per database value (true/false). checkbox wil checked or unchecked
4, checkbox are in grideview
|
|
|
|
|
mayankb_07 wrote: 1, How fill CheckBox
CheckBox1.Text="Your Text"
mayankb_07 wrote: 2, CheckBox value get it from database
3, as per database value (true/false). checkbox wil checked or unchecked
Read Value from database
if(CheckedTrue())
{
CheckBox1.Checked=True;
}
Note : CheckTrue() Will return true and false based on your database value. You need to implement that.
mayankb_07 wrote: 4, checkbox are in grideview
Use TemplateField in Gridview
Hope this will helps to resolves all of your query .
cheers,
Abhijit
|
|
|
|
|
How to send sms on particular date like on birthday etc in asp.net..
|
|
|
|