|
The issue is that the object you call toList is not a list but a single object. You must add a separate MailAddress object for each address in your string.
|
|
|
|
|
Dear All, I am having problem in configuring .aspx in window xp.
i have configured IIS and create it virtual directory as well.
when i am executing .aspx file from "localhost/folderName"
I am getting the following error
Line 26:
Line 27:
Line 28: <sessionstate timeout="60"></sessionstate>
Line 29: <authorization>
Line 30: <allow users="?" /></authorization>
the error appears in this line
Source File: C:\Inetpub\wwwroot\folderName\web.config Line: 28
I can run this without any error from VWD or VS 2005.
modified on Saturday, March 28, 2009 2:22 AM
|
|
|
|
|
What is the actual error message?
|
|
|
|
|
I have a form with many controls and on several of the controls there is a on leave handler added. where each one connects to db and does validation and disconnects. is there a way i can connect to the db only once and then when submit is hit...disconnect. so i don't have many connect disconnects.
This is for ASP.net website form.
modified on Friday, March 27, 2009 9:25 PM
|
|
|
|
|
You should try using a dataset instead of making mutiple calls to the database. When you use a dataset, you'll make one query to your database and populate the dataset with that information. At which point you can bind that data to your controls. The link below is the msdn article for working with Datasets.
http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx[^]
hope this helps
|
|
|
|
|
I can't use that because the reason i am making multiple calls is to validate the value in the text box control. So there are many controls that need validation..so on postback all this happens.
Is there any other way ... to keep a global db connection open for that page till submit is hit.
|
|
|
|
|
my gridview has image and when i try to edit and click update i get this
Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------------
Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2305
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +147
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1021
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +413
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +115
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +392
System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +643
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1217
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +853
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +87
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +86
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +155
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +172
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Can someone guide me????
|
|
|
|
|
learningman wrote: Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
don't you think this error is self explanatory? check your input.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
learningman wrote: Can someone guide me????
Well, as Yusuf said, the message is self explanatory. You have something that is a string (nvarchar) that you are treating as binary (varbinary) in SQL Server. SQL Server can't do that implicity. You have to be explicity and tell it how you want the information converted (or just confirm that you do really want it converted and it isn't an error in your code)
Since you've not shown the SQL code (this is a SQL Exception after all) we can't guide you into the portion that may be causing the error.
|
|
|
|
|
I have three ListBox on a page. Select a few items from ListBox1 and then click a button, the selected items are added to ListBox2 and ListBox3. Here is the interesting behavior I observed. See the code below. After the first loop, items are added to ListBox2. I de-select the added items in ListBox2 (ListBox2.SelectedIndex=-1). This statement not only de-select items in ListBox2 but also causes the loss of selections in ListBox1. As a result, the second loop does not add anything to ListBox3. If this statement is commented out, the second loop add all selected items from ListBox1 to ListBox3. Does anyone know why this is happening? Is this a designed behavior? How to workaround this? Thanks,
foreach(ListItem itm in ListBox1.Items)
{
if (itm.Selected)
{
ListBox2.Items.Add(itm);
}
}
ListBox2.SelectedIndex = -1; //This line makes difference
foreach (ListItem itm in ListBox1.Items)
{
if (itm.Selected)
{
ListBox3.Items.Add(itm);
}
}
TOMZ_KV
|
|
|
|
|
hi..
Try out this..
foreach (ListItem itm in ListBox1.Items)
{
if (itm.Selected)
{
ListBox2.Items.Add(itm);
}
}
foreach (ListItem itm in ListBox1.Items)
{
if (itm.Selected)
{
ListBox3.Items.Add(itm);
}
}
ListBox2.SelectedIndex = -1;
And following will be the best option according to me:
foreach (ListItem itm in ListBox1.Items)
{
if (itm.Selected)
{
ListBox2.Items.Add(itm);
ListBox3.Items.Add(itm);
}
}
ListBox2.SelectedIndex = -1;
Thanks..
|
|
|
|
|
Thanks for your reply. Your solution definitely work. However, I placed one loop into a class to reuse it for all list controls like the following:
public void MoveListItem(ListControl Box1, ListControl Box2)
{
foreach (ListItem itm in Box1.Items)
{
if (itm.Selected)
{
Box2.Items.Add(itm);
}
}
Box2.SelectedIndex = -1;
}
I then call the method:
MoveListItem(ListBox1, ListBox2);
MoveListItem(ListBox1, ListBox3);
I guess the possible workaround could be to remove the de-selection statement Box2.SelectedIndex=-1 from the method and use it outside of the method:
MoveListItem(ListBox1, ListBox2);
ListBox2.SelectedIndex = -1;
MoveListItem(ListBox1, ListBox3);
ListBox3.SelectedIndex = -1;
Another possible way is to place ListItemCollection in the mehod to hold the selected items from Box1. After adding items to Box2, re-select the items in Box1. In this case, no de-selection is needed outside of the method call.
These are all workarounds. I still think the Box1 should not lose its selection when Box2 selection is cleared.
Thanks,
TOMZ_KV
|
|
|
|
|
The issue was resolved. It is object reference that results in this behavior. When adding to ListBox2, create a new ListItem object to avoid the object reference between ListBox1 and ListBox1 like that following
ListBox2.Items.Add(new ListItem(itm.Text, itm.Value);
instead of
ListBox1.Items.Add(itm);
TOMZ_KV
|
|
|
|
|
When I bring in a Report Viewer to my web form in crystal 11.5.37 it automatically adds references to 11.5.33 as well as 11.5.37 giving me duplicate references errors. If I delete the 11.5.33 references, it keeps recreating them when I build the web site. How can I permanently destroy them?
|
|
|
|
|
It turns out that Crystal 11.5 is not compatable with Visual Studio 2008. I need to update to Crystal 2008.
|
|
|
|
|
Hello to everybody, i hope you can help me, I have a dataset which contains datas from a table..this table has 2 fields (id and data) both are string, well i want to do this:
i need to get all the datas from every id and save them into an array, i need this for every id...
Note: the id may be repeated according to the number of datas that contains that id.....for example:
...........................................................................
This is what my dataset contains
ID DATA
-------- ----
04231050 368 ...here you can see that the id is repeated
04231050 234 ...
04333333 445 ......other id repeated
04333333 557 ......
04235789 786
...........................................................................
But I want it like this:
ID DATA DATA
-------- ---- ----
04231050 368 234
04333333 445 557
04235789 786
modified on Monday, April 6, 2009 2:10 PM
|
|
|
|
|
Not really related to Asp.Net.
I recommend you to repost your question in the appropriate forum to enhance the chance to get a proper answer.
But until then you can read up on Jagged Arrays here[^] or here[^] depending on your lingual taste.
"Lots of programmers have had sex - some have even had it with members of the same species." - Pete O'Hanlon
|
|
|
|
|
put your dataset Table in to dataview and then
convert it back to table with distinct values and then covert datatable to array
as follow
C#
[code]
DataView dv=new DataView(ds.Tables["tblName"]);
DataTable temp=dv.ToTable(true,"col1","col2");
[/code]
now convert temp to array
|
|
|
|
|
Hi all,
i am kind new to ASP.NET, developing a asp.net web app with VS.NET2008 and C#.
I try to follow this tutorial:
http://www.fmsinc.com/FRee/NewTips/NET/NETtip35.asp[^]
, but it seems to be based on win32 code or something because on my web forms i cant find the same events, properties, etc. So i am traslating that code to the following:
Item = Row
grid_ItemCommand = grid_RowCommand
onmouseenter = onmouseover
onmouseleave = onmouseout, etc.
But still can't make it work on my GridView control.
Can anyone help me?
my code right now is:
protected void gvUsuarios_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
gvUsuarios.SelectedIndex = ((GridViewRow)sender).RowIndex;
}
}
protected void gvUsuarios_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (gvUsuarios.SelectedIndex > -1)
{
GridViewRow gvr = ((System.Web.UI.WebControls.GridView)sender).Rows[gvUsuarios.SelectedIndex];
if (gvr.RowType == DataControlRowType.DataRow)
{
LinkButton button = (LinkButton)gvUsuarios.Rows[gvUsuarios.SelectedIndex].Cells[1].Controls[1];
if (button != null)
{
((GridView)sender).Attributes["ondblclick"] = ClientScript.GetPostBackClientHyperlink(button, "");
}
((GridViewRow)sender).Attributes.Add("onmouseover", "highlightRow(this, '" + ColorTranslator.ToHtml(gvUsuarios.SelectedRowStyle.BackColor) + "')");
((GridViewRow)sender).Attributes.Add("onmouseout", "dehighlightRow(this, '" + ColorTranslator.ToHtml(gvUsuarios.RowStyle.BackColor) + "')");
}
}
}
<pre>
Thanks a lot!
|
|
|
|
|
It seems to me that you have exchanged the DataGrid in the article for a GridView.
Datagrids still works in later versions of visual studio. It just isn't drag'n'drop.
"Lots of programmers have had sex - some have even had it with members of the same species." - Pete O'Hanlon
|
|
|
|
|
Thanks for the tip.
Meanwhile i found the way. Here is my code if anyone is curious about it:
protected void gvUsuarios_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
GridViewRow gvr = ((GridViewRow)((LinkButton)((GridViewCommandEventArgs)e).CommandSource).Parent.Parent);
gvUsuarios.SelectedIndex = gvr.RowIndex;
}
}
protected void gvUsuarios_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow gvr = ((GridViewRowEventArgs)e).Row;
if (gvr.RowType == DataControlRowType.DataRow)
{
if (gvUsuarios.EditIndex < 0)
{
LinkButton button = (LinkButton)gvr.Cells[1].Controls[1];
if (button != null)
{
gvr.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(button, "");
}
}
if (gvr.RowIndex == gvUsuarios.SelectedIndex)
{
gvr.Attributes.Add("onmouseover", "highlightRow(this, '#B0FF62')");
gvr.Attributes.Add("onmouseout", "dehighlightRow(this, '" + ColorTranslator.ToHtml(gvUsuarios.SelectedRowStyle.BackColor) + "')");
}
else
{
gvr.Attributes.Add("onmouseover", "highlightRow(this, '" + ColorTranslator.ToHtml(Color.White) + "')");
gvr.Attributes.Add("onmouseout", "dehighlightRow(this, '" + ColorTranslator.ToHtml(gvUsuarios.RowStyle.BackColor) + "')");
}
}
}
|
|
|
|
|
Hi,
I have searched for an example of an ASP.NET web site project which would serve as a good starter for any number of web applications.
I need to create a web site which manages a load of stock for someone and the first thing I have to do is build a website with a few users who have various roles, etc. I will need to create a login form, a password retrieval form, and so on.
Does anyone know of an article or example which provides this as a project I can just download and start working with, adding my own code as I need to rather than having to repeat a load of work which has already been done?
I think it would be great for Visual Studio to have a wizard to just build and configure a web site complete with membership, security and roles built in. Then we programmers could just get on with the non-bolierplate stuff.
|
|
|
|
|
|
Hi,
In my application, I enter a string as "Show Names" in a text field which is in updatepanel. This string is stored in database. later on another page this string is used to populate the column header. The column header displays properly as
Show
Names
with break after the string "Show".
now I go back to previous page where it loads the values saved in database. There is a check box in the same update panel , clicking on it causes a postback. But then it causes a server error with code 500. It is caused by string in the text field. At any cost I need this line break for the column header from the saved column header string.
How to resolve this issue?
Thanks
kMeena
|
|
|
|
|
meenakumar wrote: error with code 500.
This is not helpful. You need to debug your code and see where it is breaking. Also uncheck "Show Friendly error" in the tools->Internet Options-> advanced menu, if you are running IE. that may be give you a better error.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|