Click here to Skip to main content
15,038,345 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I am trying to show EditItemTemplate in Datalist control, when i run in my pc (local) its working successfully but when i upload project to host and run edit button in profile page after 17-18 seconds its showing error "The network path was not found". Here is error error records, i m waiting for your helps, thanks so much.
C#
Server Error in '/' Application.

The network path was not found

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.ComponentModel.Win32Exception: The network path was not found

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.


ASP.NET
HTML Records

                        </ProgressTemplate>
                    </asp:UpdateProgress>


                                     </tr>

                                </table>


                    </EditItemTemplate>

                </asp:DataList>

                <asp:HiddenField ID="UN" runat="server" />

                <asp:SqlDataSource runat="server" ID="SqlDataSource2" ConnectionString='<%$ ConnectionStrings:db_dogalinaConnectionString %>' SelectCommand="SELECT * FROM [UserDetail] WHERE ([UserName] = @UserName)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="UN" PropertyName="Value" DefaultValue="" Name="UserName" Type="String"></asp:ControlParameter>

                    </SelectParameters>
                </asp:SqlDataSource>


C#
Code Behind CS

protected void dataEditProfile_ItemCommand(object source, DataListCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case "Edit":
                {
                    dataEditProfile.EditItemIndex = e.Item.ItemIndex;
                    dataEditProfile.DataBind();


                }break;

            case "Update":
                {`
                    BilgileriDoldur();
                    DL.Lib.ormDataContex...`

C#
void Some Record

private void BilgileriDoldur()
    {
        UserName = HttpContext.Current.User.Identity.Name;
        DL.Lib.ormDataContext db = new Lib.ormDataContext();
        SelectedUser = db.UserDetails.First(a => a.UserName == UserName);
        UN.Value = SelectedUser.UserName;


    }

XML
Web.Config ConnectionStrings

<connectionStrings>
<clear/>
<add name="dbConnectionString" connectionString="Server=mssql.******.com; Database=******; User Id=******; Password=******" providerName="System.Data.SqlClient"/>
<add name="LocalSqlServer" connectionString="Server=mssql.******.com; Database=******; User Id=admindb; Password=******" providerName="System.Data.SqlClient"/>
<add name="db_dogalinaConnectionString" connectionString="Server=mssql.******.com; Database=******; User Id=******; Password=******" providerName="System.Data.SqlClient"/></connectionStrings>
Posted
Updated 6-Jan-16 1:28am
v2

1 solution

What are accessing from network ? it seems your database connection is go on lose, please check if it really work
   
Comments
Member 10815016 6-Jan-16 9:53am
   
Thanks koolprasad2003. i realy forgot to look some codes after page postback in codebehind,
I corrected some connectionstrings for local connection;

DropDownList DropTown = (DropDownList)e.Item.FindControl("DropTown");
DropTown.DataSource = new SqlDataSource("Data Source=W7S-BILGISAYAR;Initial Catalog=test;User ID=sa;Password=*****", "SELECT * from ilceler WHERE sehir=" + DropCity.SelectedItem.Value);

Changed to;

DropDownList DropTown = (DropDownList)e.Item.FindControl("DropTown");
DropTown.DataSource = new SqlDataSource(WebConfigurationManager.ConnectionStrings["db_*********"].ConnectionString, "SELECT * from Towns WHERE sehir=" + dlCity.SelectedItem.Value);

Thanks so much good works..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900