Our Services
Consulting
Leads Manager

News
We have just launched our new site. NK Solutions has been re-branded as BIT-Soft Consulting. We have partnered with Net GINI to provide our customers the most professional and proficient service possible.
with different column and returning the record the same way the above will do(gridview). Thanks
Asynchronous page processing in 3 tier architecture

I am working on 3 tier architecture: UI, BL, DAL. In my UI i have following code for Asynchronous page processing:

 protected void Page_Load(object sender, EventArgs e)
        { 
AddOnPreRenderCompleteAsync(new BeginEventHandler(objAsync_BL.BeginAsyncWork1), new EndEventHandler(objAsync_BL.EndAsyncWork1));
}

public IAsyncResult BeginAsyncWork1(Object sender, EventArgs e, AsyncCallback cb, object state)
      {      

      }

      public void EndAsyncWork1(IAsyncResult asyncResult)
      {
       
      }


But I want a database fetch operation to be performed in this asyncronous method. And due to 3 tier arch. i am unable to do this in UI Layer. Can anyone guide me that how can I implement Asynchronous processing in 3 tier architecture?

Note: If you are going to place EndAsyncWork1 in DAL then please show that how can I return a value back to UI layer from this function.

EndAsyncWork1
EndAsyncWork1


linq error when binding to a datagrid

 

var full = from du in com_prop
                       join p in query on new { du._username, du.property } equals new { _username = p.user, p.property }
                       select new { du._username, du.property, du.value, ad_value = p.value };


i get the following error

 

Local sequence cannot be used in LINQ to SQL implementations of query operators except the Contains operator.

 

when trying to bind "full" to a datagrid or if i do

 

foreach (var a in full)
 
does anyone have any idea why this might be?
 
thanks in advance


 

close connection when doing abort?

Hi,

as pointed out in this linke:

http://msdn.microsoft.com/en-us/library/ms535920%28VS.85%29.aspx

Abort doesn't close any connection in IE 6 or IE 7.

This is a problem for me, as I have a main page and a popup, both using ajax heavily.

If I open the popup and close it very quickly, my ajax call in the popup is not finished, so the connection will not be closed.

As IE 6 and IE 7 only allow 2 server connections, when I try to only the popup page, it just hangs (as 1 used by my main page and 1 still open in use).

Is there anyway to work around it? like specifically kill a connection somehow?

Many Thanks

Jerry

how to export aspx page text to docx !!

hi everyone help me i m suffring from 3 days

i am exporting my aspx page quotation to word in 3 pages it exporting and working properly in word 2003 means doc file. but the doc file is not opening in office 2007 or giving error data is corrupt.


help me here is the code

Response.Clear();
        Response.Buffer = true;

        string filename = "Quotation.doc";
        Response.AddHeader("content-disposition", "attachment;filename=" + filename);

        Response.ContentEncoding = System.Text.Encoding.UTF7;
        Response.ContentType = "application/vnd.word";
        StringBuilder sb = new StringBuilder();


        System.IO.StringWriter oStringWriter = new System.IO.StringWriter(sb);
        System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
        tblall.RenderControl(oHtmlTextWriter);
      

        Response.Output.Write(sb);
        Response.Flush();
        Response.End();


tell me how to open it in 2007 or how to create it in 2007 office.

Dynamic Gridview page size within user control depending upon size of container.

Hi,

I have created a user control which is essentially a gridview with various pieces of functionality added to it. The rows, header and pager all have set heights.

I want to be able to drop my control into a content zone on a form that has a master page, and the table completely fill the zone.

I don't want to resize the elements to do this, I want to increase or decrease the page size depending on the number of complete rows that can fit in the content zone (assume the zone has a static height in the master, but this could differ for different master pages).

I assume I would need to know the height of the content zone to be able to calculate how many rows of height X pixels I can fit, but I have no idea how to calculate the size of the container from within the user control.

Does anyone have any ideas?

I hope this makes sense.

Thanks

Andy

Binding Data
Hi, Please can any one put me through how to bind list of data with out using gridview or datagrid or details view. I mean bind to table
Eval(columnname>
how to send gridviewrow object to java script function

I have a grid view control on my aspx page.


i have an input button in Template filed , i m calling one java script function.


I want to send Gridview row object so that i can come to know which it has been clicked.


want to play with grid view row in java script function.



-Sandeep


Dynamic Sql Server Reporting

hi, I just got recruited in a  company, My boss told me to do some research in Sql Server Reporting Service, I managed to create report, that too in the format required...

(In Visual Studio 2010 Reporting application)

But now my boss want to make some more research and come up with a mechanism to do dynamic reporting,

(in Visual studio)

If we give the Sql, Column Names, and GroupBy Field Names it should be able to give a report dynamically...

Is that possible...i think he is just tryeng to scare me off...if its possible where should i start working....Can some one give me a Road Map kind of thing that i should be doing to achive this..


Dynamic button event created within class library not fired

I know this 'dyanamic control event not fired' has been raised time and time again, but I still can't work out how to solve this issue...

I'll break down the parts and where the button is created without the 'flesh' around the code that shouldn't have an effect.

Imagine this is the stack:

default.aspx - <ui:CustomControl runat="server">
public class CustomControl : PlaceHolder
CustomControl.OnLoad(EventArgs e){ _className = new ClassName(this); }
public ClassName(CustomControl customControl) {_customControl = customControl; InitControls();}
InitControls(){_customControl.Controls.Add(ClassNameA.GetControl())
ClassNameA.GetControl(){ // this eventually returns the result of ButtonList().Bind() }
ButtonList.Bind()
{
for (int i = 0; i < ((IList)Datasource).Count; i++)
{
  IDataBindSourceItem item = ((IList)Datasource)[i] as IDataBindSourceItem;
  _buttonToRender = new Button();
  _buttonToRender.ID = string.Concat(this.ID, "_button", i);
  _buttonToRender.Text = item.Text;
  _buttonToRender.Click += new EventHandler(button_Click);
  this.Controls.Add(_buttonToRender);
}
}

button_Click never gets fired.  The annoying thing is in the app, if button list isn't used, RadioButtonList is and is attached in exactly the same way and while i haven't checked, i'd imagine I would be able to catch events from that.

Can anyone see where my problem might lie?

Script timeout issue while binding

We have a peculair case in migrating a asp application .net 3.5
In ASP the output is coming for a ten year record in tabular format with script timeout message.
In .Net we are getting System.Outof memory exception without any tables.

Have any one faced this kind of situation. What possible solution we can expect for this ?

Thanks,
Thani

Is <form> tag mandatory?

It might sound a bit of a daft question but must I have a <form> tag in order to find or iterate controls on a page within code behind?

If it's not mandatory, what object's controls collection can I iterate to programmatically access the controls on the Page please? I thought the Page object was the obvious candidate but that doesn't appear to be correct.

I ask because I am calling some code provided by a payment provider that generates open and close form tags within its own logic and I'd prefer not to mess with that logic but I do want to generate certain items on the page before that logic is called.

access master page control on aspx page that is not created by master page

hello to all i am making an asp.net web application.. i wants user to give the facility to login and 
logout on every page..I have taken two image buttons on masterpage one is of login and second of 
logout..i have two pages first is default which is created by master page
and second is login which is not created by master page.now when default page open it is written 
"Welcome:guest" , when i click
 on login after successfully login it returns to default page written as "Welcome:guest" it should 
come "Welcome:(username)",its not coming when i click again on login button after that it comes
Welcome:(username)"...This is my coding plz tell me where i am geting error..
!.)Default page
protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["cname"] != null)
        {
            Label lb = new Label();
            lb = (Label)Master.FindControl("Label2");
            lb.Text = Session["cname"].ToString();
            ImageButton ib = new ImageButton();
            ib = (ImageButton)Master.FindControl("ImageButton1");
            ib.Visible = false;
            ImageButton img = new ImageButton();
            img = (ImageButton)Master.FindControl("ImageButton2");
            img.Visible = true;
           
        }
    }
2.)Login page
 protected void imglogin_Click(object sender, ImageClickEventArgs e)
    {
        if (rb1.SelectedIndex == 1)
        {
            string uname,upas;
            uname= txtuname.Text;
            upas = txtpas.Text;
            SqlCommand cmd = con.CreateCommand();
            cmd.CommandText = "select * from customer where email="+"'"+uname+"'";
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
            {
                Session["cname"] = dr.GetString(1);
                
                 string script = "<script>RowDblClick1()</" + "script>";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "RowDblClick1", script, false);
        
            }
            else
            {
                Response.Write("<script>alert('Invalid username or password.')</script>");
            }
        }
        if (rb1.SelectedIndex == 2)
        {
          
            if ((txtuname.Text == "kshama") && (txtpas.Text == "123"))
            {
                Session["admin"] = "Admin";
                string script = "<script>RowDblClick1()</" + "script>";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "RowDblClick1", script, false);
               
            }
           
        }
       
    }
3.)Master Page
 protected void Page_Load(object sender, EventArgs e)
    {
        ViewState["pageurl"] = Request.CurrentExecutionFilePath;
        Label lb = new Label();
        lb= (Label)Master.FindControl("Label2");
        Session["ab"] = lb;
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
            if (Session["cname"] != null)
            {
                ImageButton1.Visible = false;
                ImageButton2.Visible = true;
                Label2.Text = Session["cname"].ToString();
                Response.Redirect(ViewState["pageurl"].ToString());
            }
            if (Session["admin"] != null)
            {
                ImageButton2.Visible = true;
                ImageButton1.Visible = false;
                Response.Redirect("admin.aspx");
            }
            else
            {
                RadWindowManager RadWindowManager2 = new RadWindowManager();
                RadWindowManager2.VisibleStatusbar = false;
                RadWindowManager2.Skin = "Sunset";
                RadWindowManager2.Behaviors = WindowBehaviors.Close;
                RadWindowManager2.Animation = WindowAnimation.FlyIn;
                RadWindow rd = new RadWindow();
                rd.ID = "a1";
                rd.VisibleOnPageLoad = true;
                rd.NavigateUrl = "logins.aspx";
                RadWindowManager2.Windows.Add(rd);
                Panel1.Controls.Add(RadWindowManager2);
            }
    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        if (Session["cname"] != null)
        {
            //ImageButton1.Visible = true;
            Session.Remove("cname");
            Response.Redirect(ViewState["pageurl"].ToString());
        }
        if (Session["admin"] != null)
        {
            //ImageButton1.Visible = true;
            Session.Remove("admin");
            Response.Redirect("default.aspx");
        }
    }

hello to all i am making an asp.net web application.. i wants user to give the facility to login and 

logout on every page..I have taken two image buttons on masterpage one is of login and second of 

logout..i have two pages first is default which is created by master page


and second is login which is not created by master page

I want to receive master page control on my login page that is not create by master page

.now when default page open it is written 


"Welcome:guest" , when i click


 on login after successfully login it returns to default page written as "Welcome:guest" it should 


come "Welcome:(username)",its not coming when i click again on login button after that it comes


Welcome:(username)"...This is my coding plz tell me where i am geting error..


!.)Default page


protected void Page_Load(object sender, EventArgs e)

    {

        if (Session["cname"] != null)

        {

            Label lb = new Label();

            lb = (Label)Master.FindControl("Label2");

            lb.Text = Session["cname"].ToString();

            ImageButton ib = new ImageButton();

            ib = (ImageButton)Master.FindControl("ImageButton1");

            ib.Visible = false;

            ImageButton img = new ImageButton();

            img = (ImageButton)Master.FindControl("ImageButton2");

            img.Visible = true;

           

        }

    }





2.)Login page



 protected void imglogin_Click(object sender, ImageClickEventArgs e)

    {

        if (rb1.SelectedIndex == 1)

        {

            string uname,upas;

            uname= txtuname.Text;

            upas = txtpas.Text;

            SqlCommand cmd = con.CreateCommand();


            cmd.CommandText = "select * from customer where email="+"'"+uname+"'";


            SqlDataReader dr = cmd.ExecuteReader();


            if (dr.Read())

            {

                Session["cname"] = dr.GetString(1);

                

                 string script = "<script>RowDblClick1()</" + "script>";

                ScriptManager.RegisterStartupScript(this, this.GetType(), "RowDblClick1", script, false);

        

            }

            else

            {

                Response.Write("<script>alert('Invalid username or password.')</script>");

            }


        }

        if (rb1.SelectedIndex == 2)

        {

          

            if ((txtuname.Text == "kshama") && (txtpas.Text == "123"))

            {

                Session["admin"] = "Admin";

                string script = "<script>RowDblClick1()</" + "script>";

                ScriptManager.RegisterStartupScript(this, this.GetType(), "RowDblClick1", script, false);


               

            }

           


        }


       

    }


3.)Master Page




 protected void Page_Load(object sender, EventArgs e)

    {

        ViewState["pageurl"] = Request.CurrentExecutionFilePath;

        Label lb = new Label();

        lb= (Label)Master.FindControl("Label2");

        Session["ab"] = lb;

    }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)

    {

            if (Session["cname"] != null)

            {

                ImageButton1.Visible = false;

                ImageButton2.Visible = true;

                Label2.Text = Session["cname"].ToString();

                Response.Redirect(ViewState["pageurl"].ToString());

            }

            if (Session["admin"] != null)

            {

                ImageButton2.Visible = true;

                ImageButton1.Visible = false;

                Response.Redirect("admin.aspx");

            }

            else

            {

                RadWindowManager RadWindowManager2 = new RadWindowManager();

                RadWindowManager2.VisibleStatusbar = false;

                RadWindowManager2.Skin = "Sunset";

                RadWindowManager2.Behaviors = WindowBehaviors.Close;

                RadWindowManager2.Animation = WindowAnimation.FlyIn;

                RadWindow rd = new RadWindow();

                rd.ID = "a1";

                rd.VisibleOnPageLoad = true;

                rd.NavigateUrl = "logins.aspx";

                RadWindowManager2.Windows.Add(rd);

                Panel1.Controls.Add(RadWindowManager2);

            }


    }

    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)

    {

        if (Session["cname"] != null)

        {

            //ImageButton1.Visible = true;

            Session.Remove("cname");

            Response.Redirect(ViewState["pageurl"].ToString());

        }

        if (Session["admin"] != null)

        {

            //ImageButton1.Visible = true;

            Session.Remove("admin");

            Response.Redirect("default.aspx");

        }

    }



AsynchronousfileUploader ajax

I am using a Aynchronous file uploader control to upload files.when I click on browse file button it

opens a default dialog box. But i want to open it for a folder which is created by me on my system

is any way to do this..

please reply..

Event handler not firing using Master Page and Ajax

I have the following Master Page

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Prototype.master.cs" Inherits="Simplicita.Host.Prototype" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
    <link href="CSS/General.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    
        .modalBackground {
            background-color:#CCCCCC;
            filter:alpha(opacity=70);
            opacity:0.7;
        }
        
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ToolkitScriptManager ID="tlktScriptManager" runat="server">
    </asp:ToolkitScriptManager>
    <div>
        <div id="HeaderBanner">
            <asp:Image ID="WelcomeHeading" runat="server" ImageUrl="~/Images/RockwellBannerWhite.png" />
        </div>
        <asp:ContentPlaceHolder ID="PrimaryBody" runat="server">
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>


Which is used in the following Page

<%@ Page Title="" Language="C#" MasterPageFile="~/Prototype.Master" AutoEventWireup="true" CodeBehind="CHCompanySearch.aspx.cs" Inherits="Simplicita.Host.CHCompanySearch" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PrimaryBody" runat="server">
        
        <asp:Label ID="NumberLabel" runat="server" Text="Number:" 
            style="position:absolute; left:40px; top:150px; font-family:Arial, Helvetica, sans-serif; font-size:12px;" />
        <asp:TextBox ID="txtNumber" runat="server" 
            style="position:absolute; left:200px; top:146px; width:75px;" />

        <!-- Name -->
        <asp:Label ID="CompanyName" runat="server" Text="Name:" 
            style="position:absolute; left:40px; top:180px; font-family:Arial, Helvetica, sans-serif; font-size:12px;" />
        <asp:TextBox ID="txtName" runat="server" 
            style="position:absolute; left:200px; top:176px; width:200px;" />
        <asp:Button ID="btnSearch" runat="server" Text="Search" 
            style="position:absolute; left:40px; top:230px;" onclick="btnSearch_Click" />
        <asp:Panel ID="panelSearchResults" runat="server" style="border: 1px solid #AAAAAA; background:#FFFFFF; height:160px; width:400px;">
            <asp:UpdatePanel runat="server">
                <ContentTemplate>                
                    <asp:Label runat="server" ID="lblNumber" Text="Number" style="position:absolute; left:10px; top:20px; font-family:Lucida Sans Unicode" />
                    <asp:Label runat="server" id="lblName" Text="Name" style="position:absolute; left:10px; top:50px; font-family:Lucida Sans Unicode" />
                    <asp:Button runat="server" ID="btnSave" Text="Add to Your Companies" 
                        style="position:absolute; top:100px; width:200px; left:100px;"  
                        onclick="btnSave_Click" />
                    <asp:ModalPopupExtender ID="panelSearchResults_ModalPopup" BackgroundCssClass="modalBackground" runat="server" 
                        DynamicServicePath="" Enabled="True" TargetControlID="btnSave" PopupControlID="panelSearchResults">
                    </asp:ModalPopupExtender>
                </ContentTemplate>
            </asp:UpdatePanel>
        </asp:Panel>
</asp:Content>


With the following code behind


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Simplicita.Host.CompanyService;
using Simplicita.Host.Repositories;

namespace Simplicita.Host
{
    public partial class CHCompanySearch : System.Web.UI.Page
    {
        Company foundCompany = null;
        Appointment[] contacts = null;
 
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNumber.Text == String.Empty & txtName.Text == String.Empty)
                {
                    txtNumber.Focus();
                    throw new Exception("You must provide at least a Company Number or Name to Retrieve Details from Companies House");

                }
                else if ((txtNumber.Text != String.Empty) & (txtName.Text != String.Empty))
                {
                    foundCompany = CompanyRepository.GovTalkCompanyDetailsSearch(txtNumber.Text, txtName.Text);
                    contacts = CompanyRepository.GovTalkCompanyAppointments(txtNumber.Text, txtName.Text);

                    panelSearchResults_ModalPopup.Show();

                }

                if (foundCompany != null)
                {
                    lblNumber.Text = foundCompany.CompanyNumber;
                    lblName.Text = foundCompany.CompanyName;

                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            panelSearchResults_ModalPopup.Hide();
        }

    }
}


The trouble is while the event handler for the btnSearch fires, the same can not be said for the btnSave handler.


Anyone see what obvious thing I have missed.


Ta in advance


Masterpage with datalist controls

Actually im creating a website similar to www.zedge.net         in which i want the users to download walpapers and ringtone.The page is in Masterpanel.

As im displaying the categories in the side as follows,

 

Animal       --------------------------------

Anime

Bollywood

 

                ---------------------------------

 

so the datalist will be displayed between the lines.For each Category i have an id(Cat_id),so and for each categories i have 20 images.

so when i click the category it should display the particualr categories images.i will also show u the dtabase structure of mine below,

 

Alter procedure sp_selcatagory_Downloads
(
@catid int
)
as
declare @parent varchar(50)
declare @child varchar(50)
select @parent=Parent_node , @child =Child_node from cat where cat_id = @catid
select * from [image] where parent_node = @parent and Child_node=@child

 

Main Table:

 

imageid  filename                     filepath                                    filetype             parentnode    childnode

10023    3d3.jpg                      Images/3d3.jpg                        Wallpaper         Wallpaper       Celebrities
10024    Wolfhowling.mp3        Images/Wolfhowling.mp3           Ringtone           Animal           Celebrities
10025    3d_Airtel_Beat.mp3    ringtones/3d_Airtel_Beat.mp3    Ringtone           Pop                Celebrities
10028    3d1                            Images/3d1.jpg                       Wallpaper         Wallpaper      Celebrities
10029    3d2                            Images/3d2.jpg                       Wallpaper         Wallpaper       Celebrities

 

Categroy Master

Childnode     parentnode    Cat_id

Animal
 Wallpaper           1
Anime  Wallpaper           2
Bollywood  Wallpaper           3

So pls help me in this.

And i also want to display the number of downloads made for each image at the bottom of the image,and image counts t the side of the category

that is,

Animal(20)

Anime(24)

 

find control in datalist by javascript(Not by Code Behind CS Page or ItemDatabound)

Hello all,

I am facing a problem with javascript.Following is the scenario:

I am working on survey application......

I have taken a datalist in which the question in survey are bound in a label control

now user can change color of the question using color picker

color picker have a popup which is closed when user selects a color and

the color of question will be updated as popup closes

So i have to find label control(in which i bound questions)

in datalist by javascript only (not by Cs page or by itemdatabound event because of color picker popup i can not use cs page)

and update the color of label selected by color picker


I googled and found following code but it show null value

var lbl = document.getElementById('<%= Page.Master.FindControl("ContentPlaceHolder1").FindControl("dList").FindControl("lblQuestion") %>');

when I saw the page source following id is generated for label

ctl00_ContentPlaceHolder1_dList_ctl00_lblQuestion
ctl00_ContentPlaceHolder1_dList_ctl01_lblQuestion
and so on


Does any body have a solution?
Please help..........






Difference between iis/win2003 and iis/win2008

Hello there


I have a serious problem with my asp.net application. Since yesterday i got a timemout error when i request a web page. The web page sends a request to a sal server 2008 and fail with timeout error.


This application is running under /win2008 standard edition.


I tried to use the same application on iis/win2003 with the same sql server database, it runs with no problem.


Is there any difference between IIS/win2003 and IIS/win2008 settings?


Thanks for any help



Surfing the website

We are busy building a inventory management system for books. We intend to scan the ISBN on the books and then retrieve the book details from the internet using the ISBN. The details are then to be displayed in textboxes and then added to the database. The adding is not the problem. The issue is retrieving the details using the ISBN and placing them in textboxes. 

Any Suggestions?   

Description: Connection refused

Hi All,

I am facing the error:  Connection refused , When i am browsing any web page on my local machine.

I even tried to browse the web pages in my default web site, but facing  the same error.

My machine is having visual studio. net 2008 and 2005. the data base I am using is Sql server 2005.

The OS is windows xp sp 3

Warm regards and thanks,

NIK24

 

 

Asynchronous page processing

I am working on 3 tier architecture: UI, BL, DAL

In my UI i have following code for Asynchronous page processing

AddOnPreRenderCompleteAsync(new BeginEventHandler(objAsync_BL.BeginAsyncWork1), new EndEventHandler(objAsync_BL.EndAsyncWork1));

objAsync_BL.BeginAsyncWork1 and objAsync_BL.EndAsyncWork1 are functions in BL and the call the functions objAsync_DL.BeginAsyncWork1 objAsync_DL.EndAsyncWork1 of DAL.

Now i am colleceting an output parameter of type string in EndAsyncWork1 of DAL and i want to return thisstring to UI. But the problem is that EndAsyncWork1 has return type void; below is the defination of both the functions:

        public IAsyncResult BeginAsyncWork1(Object sender, EventArgs e, AsyncCallback cb, object state)
        {
            open();
            op = new SqlParameter("@Result", SqlDbType.VarChar, 50);
            op.Direction = ParameterDirection.Output;

            cmd = new SqlCommand("fs_check", con);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pm1 = new SqlParameter();
            pm1 = new SqlParameter("@email_id", "abcd");

            cmd.Parameters.Add(pm1);
            cmd.Parameters.Add(op);       

            return cmd.BeginExecuteReader(cb, state);

        }

        public void EndAsyncWork1(IAsyncResult asyncResult)
        {
            string _emailIdFS = null;

            cmd.EndExecuteNonQuery(asyncResult);
            _emailIdFS = op.Value.ToString();
            
            return _emailIdFS;
        }


When I am changing the return type of EndAsyncWork1 to string, I am getting the following error: (changed in both BL, and DAL)

Error    1    'string BusinessLayer.Async_BL.EndAsyncWork1(System.IAsyncResult)' has the wrong return type

----------------------------------------------------------------------------------------------

Also BeginAsyncWork1 accepts following parameter

(Object sender, EventArgs e, AsyncCallback cb, object state)

I want to pass one more string type to this function like (Object sender, EventArgs e, AsyncCallback cb, object state, string s)

but it is giving error that "No overload for 'BeginAsyncWork1' matches delegate 'System.Web.BeginEventHandler' "


Calendar - Add to Table

Dear All,

May I ask your knowledge regarding the following: VB.net

I have a datefrom and dateto calendar then a button

Table:  CutoffID, CutoffName, DateFrom, DateTo, Status, ModifiedStatus, DaysLate, DateCreated, CreatedBy

I can I do the following:

CutoffName: Get data from Datefrom and Date to: ex August 1, 2010 - August 15, 2010 : how can I add two strings

DateFrom: data from the calendar DateFrom

DateTo: data from the calendar DateTo

Status: I will have two status Saved and Unsaved.  Once click button it will be Unsaved - then on next page once submit it will be saved (Add employee schedule per shift - next page)

ModifiedStatus: 100% if not modified if saved.  If there's a modification on next - will get cutoffid link to another table

DaysLate: number of day from days from

DateCreated: date I click the button to add

Createdby: username login

'_______________

May I also ask if how can I increment a day on my array.  Ex if i have Aug 1-15 cut-off.  My loop will be if not august 15 add 1 day to August 1 then until condition is met (will be used for the next page)

Hoping for your knowledge or link to an example.  Thank you very much.

 

 

problem with joining tables in Linq to SQL in methods

Hi

I have a problem with joining tables in Linq to SQL in methods

I have a GridView to show subgroup information along with Group Name

Here is my code that works fine

MyDataContext db = new MyDataContext ();

Var result = from SubGroup in db.SubGroups

join Group in db.Groups on

SubGroup.GroupID equals Group.id

select new

{

id = SubGroup.id,

GroupName = Group.Group_Name,

Full_Name = SubGroup.Full_Name,

};

GridView1.DataSource = result;

GridView1.DataBind();

 

But I don't know how to handle it by a methot like below :

public IQueryable<SubGroup> GetAllSubGroup ()

{

MyDataContext db = new MyDataContext ();

Var result = from SubGroup in db.SubGroups

join Group in db.Groups on

SubGroup.GroupID equals Group.id

select new

{

id = SubGroup.id,

GroupName = Group.Group_Name,

Full_Name = SubGroup.Full_Name,

};

 

return result;

}

Is there any way to do this? I will very thankfull for your helps

Wizard control ActiveViewIndex

Hello all, I am having an issue with using a wizard control. I am trying to manually set the selected tab page which works fine when I am on the same page. For example, you could click on the TabStrip or Next and Back buttons and it will render the selected tab correctly. However when I navigate away from the page and then return back for some reason it seems to select 2 tab pages but while I was debugging the:

  • Wizard's ActiveViewIndex is what I want it to be.
  • TabStrip.SelectedIndex is exactly what I want it to be.


Is this a known issue for Wizards?


            tabStrip.Items[0].Selected = true;
            wizard.ActiveViewIndex = 0;



Retrieving formatted content from contenteditable div

Hope y'all can help me out with this.

I'm trying to create one of those HTML wysiwig boxes (much like this one that I am typing in right now) for text entry on a webpage.

The DIV looks like this:

[CODE]<div id="divEditor" runat="server" contenteditable="true" style="height:200px; border:1px solid black">
                This is the content. It is a test paragraph.
            </div>[/CODE]

I use execCommand(doFormat('bold'), false, null) to style the DIV content.

The problem is, I want to retrieve the content to save into a database, but the innerHTML of the DIV is merely the text itself without the formatting.

Any ideas? Am I barking up the wrong tree?

(There is an HTML editor control in the AJAX control toolkit, but it only exists for .NET 4.0 and unfortunately at work we are still using 2.0)

How do I determine the physical location of my ASP.NET website?

Hi - I've set up IIS7 on my home computer and have written a very basic ASP.NET website to be deployed on this webserver.  Everything works great.  How do I determine programmatically the physical path (for instance, "C:\inetpub_MyWebsite\") of the website? 

I need to write an XML file to the website's root folder dynamically and therefore need to know the folder's physical location.

Thanks so much!

 


Code Project News | Dilbert | Research | MSDN News | ASP.NET Forums | Babak's Development Blog
Copyright 2008 bitsoftconsulting.com. All Rights Reserved