Wednesday, August 18, 2010

How do I display data in a textbox based on an ID passed from 1st page?

On my Home page I have a gridview that has Four columns: CustomerID, Product, Quantity, then a link (which appears on each row..called View). When a user clicks View on a particular row it will then send that particular CustomerID to the next page (CustomerProfile.aspx).





On the CustomerProfile.aspx page I have a textbox where the Customer Name should appear. How do I go about displaying the customer name in the textbox based on the CustomerID passed to the customerprofile.aspx page? Do I need to call a stored procedure? Do i need to call the Customer Table in my code?





(i'm using C#) Thanks!! Ur help is very much appreciated!How do I display data in a textbox based on an ID passed from 1st page?
In PHP it would be: $_SESSION['CustomerID']





--------





Sorry, didn't see that part the first time thru. You would need to pull from your database table. Sounds like you know what you're doing, but it would be something like this (again in PHP):





$query = ';SELECT Customer_Name FROM TableName WHERE CustomerID=CustomerID';;


$result = mysql_query($query);


$row = mysql_fetch_array($result);


$customer = $row['CustomerID'];

VISUAL WEB DEVELOPER, NEED HELP!!!?




for the past 2 years I have been working with Visual Basic 6 and have gotten pretty used to it. Problem is, now I have to get to know Visual Web Developer because I need to make a program that can use the internet as well. This means I have a short time to get used to it and need help.





How do I show results from one table in an MS Access Database but using primary keys?





e.g. if I have 2 tables (X %26amp; Y) how do I use one Field in table X to return results from table Y. I am using an ASP GridView and a Drop Down box to do it but if there is abetter way then so be it.VISUAL WEB DEVELOPER, NEED HELP!!!?
Create view using SQL (http://www.w3schools.com/sql/default.asp鈥?/a>

Want to set the column names of the data grid with numerical values?




I'm just trying to view the contents of my table in a grid view control and the contents of the control will vary from time to time. So I tried to bind the data in run time with the grid view..





now the problem which I'm facing is, some of the columns in the table are named as m1,m2,m3.. Now I want to display the column names in the user interface or grid as 1,2,3..so on up to the number of columns does the grid view have..





like I have a table in database as with the column names as





sno name reg no m1 m2 m3 ............mn








now I want to display them as








sno name regno 1 2 3 ..........n








how is it possible if we are binding the gridview with the table at runtime





hope I have done with my explanation.. I would expect the result as early as possible...





thanks in advance


--radhaWant to set the column names of the data grid with numerical values?
If its just the matter of displaying different name of the column in the grid then you can set header text of column of grid at run time with code , I am not sure with syntax. Use msdn for best
  • web hosting talk
  • loan
  • Visual Basic help!?




    I have a bit of a problem with Visual Basic here. I'm basically working with a database that displays bikes for a company which has a number of different bike dealers. I need to design the site like this - the dealer signs in on the front page with their unique password given to them (I have the passwords in a database) and the GridView (or maybe something else would be better?) should display only that particular dealer's bikes. Now, this is the tricky part because I have no idea how to achieve that, neither by means of an SQL query nor VB codebehind. Answers would be very much obliged.





    NSVisual Basic help!?
    Depends on how your database is build. But lets assume you have the password database with something like password_db(key number, password text, for_id number). Now the for id is the id of the byke company. Now you have a second DB which has the companies more or less this structure: byke_companies(key number, name text) now you have the third which have the bikes bikes(key number, bikename text, bykeprice number, for_id number). Now the for_id of both tables are the byke_companies key. So to Select in SQL SELECT * FROM bikes WHERE bikes.for_id = (SELECT for_id FROM password_db WHERE password = 'thepassword') thepassword you have to catch from a field, don't forgett protection, meaning passwordsave your database, make the passwords be a MD5 checksum or something like that, do never store passwords in plaintext. If you do it in a mdb file you should make sure that they cannot open it without password, even if they press ';shift'; and then ';open';. In VB you can run Queries with this command DoCmd.RunSQL (query). If you want a resultset you need following command


    Set dbVOA = CurrentDb


    Set rstName = dbVOA.OpenRecordset(query)


    the rstName is a resultset. Google for that for further information about how to handle this.

    Multi column listbox .Net?




    I would like to know how to go about creating a multi column listbox. I've searched for about 3 days now and there doesn't seem to a solution for this problem. I've asked this question on multiple forums and most people ask me to use a listview. I cannot use a listview because my requirement is to come up with a multi column listbox, not listview or gridview. I'm also creating a website. So I cannot use a listview. Any kind of help would be appreciated as this problem has been giving me nightmares for the past 3 days. Thanks. Multi column listbox .Net?
    Check out the following:





    http://www.codeproject.com/KB/cpp/mclb.a鈥?/a>

    How to select that cells?

    I'm using asp.net (C#), i have a grid view like below:





    ID


    01 Edit


    02 Edit


    03 Edit





    Then have code:





    protected void ibtnEdit_Click(object sender, ImageClickEventArgs e)


    {


    foreach (GridViewRow gvr in gvwThreads.Rows)


    {


    Literal litId = (Literal)gvr.FindControl(';litId';);


    Response.Redirect(';A.aspx?ID='; + litId.Text, true);


    }


    }





    The edit in the gridview is imagebutton that will link to page A.aspx. When i click on id 01 edit, it'll go to A.aspx with 01 details. But when i click on id 02 or 03 edit, it also go to A.aspx with 01 details but not 02 or 03 details.





    Why this happened? How to fix it when i click 01 edit it'll go A.aspx with 01 details %26amp; click 02 or 03 edit will go A.aspx with 02 or 03 details?How to select that cells?
    I don't write in C# so you'll have to translate the syntax but...





    I think your ForEach loop is assigning ALL rows to the litID. But it quits when it fills the first time. So you need to make sure you're assigning the selected row.





    Try a conditional to check the row index = the selected index, like:


    For each ...Rows


    FindControl


    If litID = e (your event argument)


    Response.Redirect(';A.aspx?ID='; + litId.Text, true);


    end if


    NextHow to select that cells?
    try





    string str





    str = GridViewRow.CurrentRow.Cells[0].Value.To鈥?br>




    Response.Redirect(';A.aspx?ID='; + str,True);

    I have a table (employee) in sqlserver with these fields(Id,Name,Family,Birthdat鈥?,?

    Now I want to show the information with asp.net , but I shoulnt use Gridview to show the info , I have to use Tbale instead , but i dont know how to do that , I just know how to show it with grid view using this code:


    SqlConnection con = new SqlConnection(ConfigurationManager.Conne鈥?br>

    SqlCommand cmd = new SqlCommand(';select * from employee';, con);


    cmd.Connection.Open();


    SqlDataReader dr = cmd.ExecuteReader();


    GridView1.DataSource = dr;


    GridView1.DataBind();


    cmd.Connection.Close();





    can you tell me plz how can i do this with table ?I have a table (employee) in sqlserver with these fields(Id,Name,Family,Birthdat鈥?,?
    Here's something to get you started. Make sure you are implementing the System.Data interface as well:





    SqlConnection con = new SqlConnection(ConfigurationManager.Conne鈥?br>

    SqlCommand cmd = new SqlCommand(';select * from employee';, con);


    cmd.Connection.Open();


    SqlDataAdapter da = new SqlDataAdapter(cmd);


    DataSet ds = new DataSet();


    da.Fill(ds);


    foreach (DataRow row in ds.Tables[0].Rows)


    {


    TableRow tRow = new TableRow();


    TableCell cellOne = new TableCell();


    // Add as many table cells as you need...





    cellOne.Text = row[';ColumnName';].ToString();


    // Update the cells' text properties. You can also update the


    // properties of the row based on DB criteria.





    // Add the cell to the row


    tRow.Cells.Add(cellOne);





    // Add the row to the table


    Table.Rows.Add(tRow);





    }

    How to implement stored procedure using ADO.NET?

    There are 2 tables in “GoodCompany” database “Customers” and “Sales”. You have a valid connection string called “MyConnection” with default database set to “GoodCompany”.








    “Customers” has “CustID” as primary key/identity and “FullName” field.








    “Sales” has “ProdID” as primary key/identity, “ProductName”, and “CustID” that is foreign key to the “Customers” table.





    SELECT CustID, FullName, ProdID, ProductName


    FROM Customers c, Sales s


    WHERE c.CustID = s.CustID





    Please do the following using ADO.NET:





    Create a Stored Procedure that takes CustID as a parameter and returns all Sales for that customer along with Customer’s name.





    Explain how to populate a GridView with this data.





    SEE my answer in the Details section... Is is right?How to implement stored procedure using ADO.NET?
    Looks correct to me. A little tip: when populating stored procedure parameters, I find this syntax more readable:





    command.Parameters.Add(';@CustID';, SqlDbType.NVarChar).Value = custID





    This way you can declare the parameter, its type and set its value all on one line.

    How to refresh entire page after gridview is updated?

    when i updated a row in gridview, or delete a row from gridview, onli the gridview is updated. however any codes outside of gridview will not be refreshed.





    lets say i have a gridview with productname, price,etc





    and a label that displays the Total sum of everything thats in the cart, calling on the method Total()





    however whenever i update or delete something from gridview, only gridview changes. the total only changes once i REFRESH that page manually myself. how do i enable the page to do a refresh whenever a change is done to gridview?How to refresh entire page after gridview is updated?
    Encapsulate the logic that refreshes them in functions. Obviously the code that refreshes them is there in your code, but its not being called after you update your GridView.





    After updating your Gridview, call the functions that refresh the controls in the page which you wish to refresh.





    Hope this helps.How to refresh entire page after gridview is updated?
    What program are you in?
  • web hosting talk
  • loan
  • How to display a message box when gridview_RowDeleting event performs?

    MessageBox.Show(...)





    Loren Soth

    ASP.NET how do I customize a dynamic data web site?

    I have gotten my data displayed properly in scaffolds but I would like to rearrange gridview columns for some tables and add some formatting for the resulting data. Also, I want to change the view for inserting items ... and... Sometimes on table joins, it displays the wrong column. How can I change how the data is displayed for an individual table?





    To summarize:





    ASP.NET


    SQL Server


    LINQ to SQL connection and pulling the correct data


    Using a dynamic data web site with scaffold all tables = TRUE in the global.asax...now I want to customize the look and feel of particular tables that get scaffolded.ASP.NET how do I customize a dynamic data web site?
    Set the gridview to no autogeneratecolumns=';false'; and set the binding yourself.

    I have written a store procedure in sql server, and i have connected the sqlserver to .net, ?

    I wrote this code in win app :


    private void button1_Click(object sender, EventArgs e)


    {


    SqlConnection con = new SqlConnection(@';Data Source=.;Initial Catalog=MyDB;Integrated Security=True';);


    SqlCommand cmd = new SqlCommand(';hi';, con);


    cmd.CommandType = CommandType.StoredProcedure;


    cmd.Connection.Open();


    SqlDataReader dr = cmd.ExecuteReader();


    dataGridView1.DataSource = dr;//give data to gridview


    // I dont know what should i write here to bind data





    dr.NextResult();


    }


    and i dont know how can i bind data in win app , but in asp.net we can use this statement :gridview1.databind();I have written a store procedure in sql server, and i have connected the sqlserver to .net, ?
    try here sqldatadaptor,dataset in place of datareader


    u cant bind DGV1 with datareader.


    dim ad as sqldataadaptor=new sqldataadaptor


    ad.selectcommand=cmd


    dim ds as dataset=new dataset


    ad.fill(ds,';tablename';)


    dataGridView1.DataSource = ds.tables(0)





    whole code is





    private void button1_Click(object sender, EventArgs e)


    {


    SqlConnection con = new SqlConnection(@';Data Source=.;Initial Catalog=MyDB;Integrated Security=True';;)


    cmd=new sqlcommand


    cmd.connection=SqlConnection con


    cmd.commandtext=';name of stored procedure';


    cmd.CommandType = CommandType.StoredProcedure;


    cmd.Connection.Open();


    dim ad as sqldataadaptor=new sqldataadaptor


    ad.selectcommand=cmd


    dim ds as dataset=new dataset


    ad.fill(ds,';tablename';)


    dataGridView1.DataSource = ds.tables(0)








    Any error . u can ask

    Where do i learn asp.net?

    Dear friends


    i have installed visual studio 2005 with oracle as back end. I work with C# codings. I am totally new. But capable of building projects at smaller levels. i need to learn the use of each and every control used in asp.net . I am capable of connecting to oracle and i can also save, update , delete , search records and i too know the basic use of gridview control. I have worked entirely using condings. A sample is given below





    public partial class _Default : System.Web.UI.Page


    {


    public OracleCommand cmd;


    public OracleDataAdapter da;


    public OracleDataReader dr;


    public DataSet ds;


    public OracleConnection con;


    string Strconnection = ConfigurationSettings.AppSettings[';Conne鈥?br>




    protected void btnSave_Click(object sender, EventArgs e)


    {


    try


    {


    string query;


    con = new OracleConnection(Strconnection);


    con.Open();


    query = ';insert into t1(id,name) values('; + txtId.Text + ';,''; + txtName.Text + ';')';;


    OracleCommand cmd = new OracleCommand(query, con);


    cmd.ExecuteNonQuery();


    con.Close();


    lb1.Text = ';Record inserted Successfully';;


    }


    catch


    {


    lb1.Text = ';No record inserted';;





    }


    finally


    {


    con.Close();


    }





    }





    How do i go head with other controls. I want to know the usage of all controls through codings only. Where i learn. Is there any one to teach me online or through phone. Am i using ASP 2.0 in visual studio 2005? i dont know this. What is the frame work used in visual studio 2005. Guide me...Where do i learn asp.net?
    Use torent and download tutorial from lynda.comWhere do i learn asp.net?
    You are using ASP.NET 2.0 (generally) in Visual Studio 2005, Visual Studio 2008 defaults to .NET 3.0 or 3.5 I think. A good book which is really cheap to have as a reference on ASP.NET is Wrox's Professional ASP.NET 2.0 (http://product.half.ebay.com/Professiona鈥?/a> It's ';obsolete'; therefor cheap :) and still very useful. It'll cover a lot of standard topics like user management, profile management, database connectivity, master pages, Javascript Callbacks (although I prefer AJAX and webservices now), XML webservices, and so on.
    Try checking out this website; http://w3schools.com/aspnet/default.asp it will be a great way to start.

    I want to know how store and retrive images through Asp.net in Sql server 2005, ??

    Hey friends i want to know HOw store images like gif, jpeg,png file in sql server 2005 database? using Asp.net in c# or Vb.net whatever? and how to retrive it from sql server into asp.net web page as well as the image control and gridview control also? actually i m a student and i doing one project so i need some help pls guid me .... thanx for your any replyI want to know how store and retrive images through Asp.net in Sql server 2005, ??
    SQL server has a data type called image, when you create the table you can enter that as the field type... alternately you can store the path to the images in which case you need to use nvarchar(1000)





    And the rest, use the sqlconnection data type.I want to know how store and retrive images through Asp.net in Sql server 2005, ??
    This page pretty much says how to do it.





    http://www.asp.net/learn/data-access/tut鈥?/a>

    VB.NET--Stored Procedures?

    There are 2 tables in “GoodCompany” database “Customers” and “Sales”. You have a valid connection string called “MyConnection” with default database set to “GoodCompany”.








    “Customers” has “CustID” as primary key/identity and “FullName” field.








    “Sales” has “ProdID” as primary key/identity, “ProductName”, and “CustID” that is foreign key to the “Customers” table.





    SELECT CustID, FullName, ProdID, ProductName


    FROM Customers c, Sales s


    WHERE c.CustID = s.CustID





    Please do the following using ADO.NET:





    Create a Stored Procedure that takes CustID as a parameter and returns all Sales for that customer along with Customer’s name.





    Explain how to populate a GridView with this data.VB.NET--Stored Procedures?
    And the compensation for completing this is???


    You will do better to at least try, post what code you've got, THEN ask for help. As the old saying goes :





    ';The Coding Gods help those who help themselves';
  • web hosting talk
  • loan
  • Will .net 2005 supports MS Access 2007?

    Related question: How to edit gridview with asp.net c#2005 through ms access database?Will .net 2005 supports MS Access 2007?
    yeah it should be.

    How do I connect to a function written in a module in Access from .Net?

    I'm trying to build an aspx page that connects to an access database query and populates a gridview with the queried results. My query uses a function that I wrote in a module in the access database. The function works fine in access but when it comes to populating my gridview on my aspx page it doesn't work. I receive an error message that says that it can't find the function that I wrote in the access database module. I'm confused!





    Help!How do I connect to a function written in a module in Access from .Net?
    As far as I know, Access will not execute VBA functions across the Jet Engine, this is a limitation of Access (probably for security reasons).





    Why not just use SQL Server Express or execute the same functions in .Net syntax after you get the data reader?





    http://www.microsoft.com/downloads/detai鈥?/a>





    http://www.microsoft.com/downloads/detai鈥?/a>

    How can I get column value from dataset in c# windows application code behind?

    I have c# window application, I create GridView to get data from database, coding is like this:





    DataSet countrydata = countryinfo.GetCountryInfo(this.getDbfil鈥?br>

    if (countrydata != null)


    {


    this.gvCountry.DataSource = countrydata.Tables[0];


    }





    //gvCountry is the name of GridView Control











    In GetCountryInfo function, I used SqlDataAdapter to get records from DataBase which is fine





    For string data type, I only need to show data value which is worked fine, but there are some data is Bool (for example column1), I need to show it in checkbox, for example, if column1 is true, then checkbox is checked, how can I get value of cloumn1? I have tried countrydata.Tables[0].Columns[';column1';]鈥?but it doesn't work, I cannot use %26lt;%# DataBinder.Eval(Container.DataItem, ';column1';)%%26gt; becaus eit is windows application not web application, I need to do everythig in code behind





    Thanks a lotHow can I get column value from dataset in c# windows application code behind?
    You can do this in gvCountry_Rowdatabound or gvCountry_Itemdatabound event.





    Inside the event do the following.


    Find your checkbox control using FindControl method.


    get the boolean value from your data source.


    and set the value to checkbox.

    Monday, August 16, 2010

    Exception in deploying asp.net project?

    I have made an asp.net project.M going to deploye it.Simply -I copied all folder and files of my project in C:\\Initpub\webroot.


    It working ,but those files are giving exception which having GridView(Means when I am attempting to use GridView's page)--';Error in login 'User-name'';.


    M using SQL Server 2005,C#,and Asp.net.


    Plz send me steps that how I can upload/Deploye my project.Exception in deploying asp.net project?
    yupException in deploying asp.net project?
    Try combinations of security user inside and outside of your database.

    Dynamic .NET Images?

    I am new to ASP.NET and web design and was wondering how would you create a dynamic image in .NET. I am connected to a SQL server which holds all the data and currently have it all set up in a gridview, i need to now get each image displayed uniquely. I can get the image file name to appear but not the actual image itself. thank you.Dynamic .NET Images?
    Use Template column to display image. Bind the datasource to datagrid through Dataset (filled with databased values including path from database) %26amp; type below code in


    HTML source





    Here is the code








    %26lt;asp:Datagrid id=';dgImage'; runat=server AutoGenerateColumns=false%26gt;


    %26lt;Columns%26gt;


    %26lt;asp:templatecolumn HeaderText=';Image';%26gt; %26lt;ItemTemplate%26gt; %26lt;img


    src='%26lt;%# DataBinder.Eval(Container, ';DataItem.ImgPath';) %%26gt;'


    /%26gt; %26lt;/ItemTemplate%26gt;


    %26lt;/asp:templatecolumn%26gt;


    %26lt;/Columns%26gt;


    %26lt;/asp:DataGrid%26gt;
  • web hosting talk
  • loan
  • File upload using asp.net and c#.net?

    I have to write code for uploading and downloading files for my website. I was successful in doing this. I am using GridView control to show the files which are in my webserver. The way now I am showing the files is





    filename ----- select link


    eg: abc.doc ----- select





    so when user clicks this select link he will be able to download the file.


    But what I want is , if the user directly clicks the file name he should be able to download the file. I am not sure how to do this using GridView control. I don’t want the select link beside the filename.





    eg: abc.txt





    Any help will be appreciated.File upload using asp.net and c#.net?
    The ASP .NET FileUpload control will take care of things. To download, you can use the webclient class in .NET. Some programmers roll their own download, because it is a matter of setting the http header and then sending a stream of bytes (binary for jpegs, for instance).





    A nice example of full fledges download/upload controls and folder management in asp .net appeared in asp .net pro - May 2007 ';Build a web based briefcase';. Take a look.

    How to display info. on Page 2 that refers to info on Page 1?

    On my HomePage.aspx I have a gridview that displays several columns (Book ID, BookName, AuthorName). When I click on the ';View'; link button on the gridview (its on each row) it takes me to a page which displays a each of these in a textbox (using session variables). As you can see below in my Book table I have another column called ';Book Review'; but i do not want this displayed on my gridview on Homepage.aspx.





    However, I would like to display ';Book Review'; on ';ViewBookReview.aspx'; page in a textbox. How would I go about doing this? Thank yoU!! If you need me to further explain I can do that as well.





    **I've tried the method of making BookReview column invisible on the gridview so it can pass to the other page..it doesn't work**





    ***Book***


    Book ID


    BookName


    BookReview





    ***Author***


    BookID


    AuthorNameHow to display info. on Page 2 that refers to info on Page 1?
    I'm not exactly sure what your trying to get done, but it sounds like you need to set the peramiters of ViewBookReview.aspx to be displayed in a seperate gridbox by forcing the link to show in a box with a different name. Sorry, I could help more if I knew exactly what you are trying to do. I will keep an eye on your post if you can give more info.

    Load data into datagridview?

    How would I load data into my datagridview in c# and then release the datasource, but keep the data in the gridview, so it can be edited?





    I am using some code that imports a csv file to my datagridview and I need to release the datasource so I can edit the contents fo the grid and export as a different file. Any help would be nice. Or if anyone knows where I can get some code to view, create and edit CSV files in C#.Load data into datagridview?
    well i think its not possible to directly read from a CSV file......u could apply some logic to interpret the data like parsing the text to obtain the fields....

    Date Ranges and vb.net?

    I want to be able to filter a gridview on a date range of a week, month and year. How would I go about getting the current weeks values and the same must apply to the month and year.


    I am getting the data that I am wanting to view from a sql database and in the table there is a LogDate field which stores the value as a short date string.Date Ranges and vb.net?
    I am not quite sure what you're trying to accomplish, but I'm assuming that you want to run a SQL query and return only records where the LogDate value is after midnight for Sunday of this week and before midnight of Saturday of this week. If that's the case, use the following code to determine your startdate and your enddate, and then pass these values into your SQL queries as parameters, like this:





    Public Class Form1





    Private Sub A() Handles Me.Load


    Dim startDay As DateTime


    Dim endDay As DateTime


    Select Case DateTime.Now.DayOfWeek


    Case DayOfWeek.Sunday


    startDay = New DateTime(Now.Year, Now.Month, Now.Day)


    endDay = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59) + New TimeSpan(6, 0, 0, 0)


    Case DayOfWeek.Monday


    startDay = New DateTime(Now.Year, Now.Month, Now.Day) - New TimeSpan(1, 0, 0, 0)


    endDay = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59) + New TimeSpan(5, 0, 0, 0)


    Case DayOfWeek.Tuesday


    startDay = New DateTime(Now.Year, Now.Month, Now.Day) - New TimeSpan(2, 0, 0, 0)


    endDay = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59) + New TimeSpan(4, 0, 0, 0)


    Case DayOfWeek.Wednesday


    startDay = New DateTime(Now.Year, Now.Month, Now.Day) - New TimeSpan(3, 0, 0, 0)


    endDay = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59) + New TimeSpan(3, 0, 0, 0)


    Case DayOfWeek.Thursday


    startDay = New DateTime(Now.Year, Now.Month, Now.Day) - New TimeSpan(4, 0, 0, 0)


    endDay = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59) + New TimeSpan(2, 0, 0, 0)


    Case DayOfWeek.Friday


    startDay = New DateTime(Now.Year, Now.Month, Now.Day) - New TimeSpan(5, 0, 0, 0)


    endDay = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59) + New TimeSpan(1, 0, 0, 0)


    Case DayOfWeek.Saturday


    startDay = New DateTime(Now.Year, Now.Month, Now.Day) - New TimeSpan(6, 0, 0, 0)


    endDay = New DateTime(Now.Year, Now.Month, Now.Day, 23, 59, 59)


    End Select


    Dim cn As New SqlClient.SqlConnection(';'''INSERT YOUR CONNECTION DATA HERE'''';)


    Dim sql As String = ';SELECT * FROM TABLE WHERE LOGDATE %26gt; @STARTDATE AND LOGDATE %26lt; @ENDDATE';


    Dim cmd As New SqlClient.SqlCommand(sql, cn)


    cmd.Parameters.AddWithValue(';@STARTDATE';鈥?startDay)


    cmd.Parameters.AddWithValue(';@ENDDATE';, endDay)


    End Sub





    End Class





    Alternatively, if you want to be able to pick the boundary days (like from a Tuesday to a Thursday, or from a Wednesday to a Wednesday) you could simply put 2 DateTimePicker controls on your form and pass their values to your query.





    There are many other ways to do this, so if you want a different method, contact me and I've got more ideas.





    I hope this helps.Date Ranges and vb.net?
    The past week is today minus 6 days, the month is either today minus 29 days or 30 days or today but one month earlier (watch the rollover for January) and the year is either today minus 364 days (or 365 days for a leap year) or today but one year earlier. There's a date function that allows you to do arithmetic on dates (in VB) called DateDiff. Then you do a Select for the ';between'; dates you want.





    (As an aside, the date is stored as in integer, regardless of how it's displayed.)

    VB.Net Grid View?

    I have a grid view called gvPayer and I have a Select button field for each row in the grid. When I click on the certain select button i want to store the data in the first cell of that row in payerid. How do I pull the actual value/text of the cells from a gridview?VB.Net Grid View?
    use the selectedrow propertyVB.Net Grid View?
    I have not done it with a GridView, but in a DataGrid, you could wire up an event to button controls, and one of the arguments passed in will give you the row number in the DataGrid.

    Convert datetime to shortdate...?

    I'm using ASP.Net c#.





    I have a gridview. Then inside the gridview have a column called Birthday. When I load from the database, it always shows time format dd/MM/yyyy hh:mm:ss.





    How i gonna make it show dd/MM/yyyy only?Convert datetime to shortdate...?
    in the asp:bound, set EncodeHtml = false, dataformatstring={0:dd/MM/yyyy}Convert datetime to shortdate...?
    eg:





    DateTime dt = new DateTime();


    dt = DateTime.Now;


    dt.ToShortDateString();





    You have more methods in the DateTime struct.
  • web hosting talk
  • loan
  • In ASP.net the GirdView Control causes my page to submit twice with one click on any row command button, Why?

    In ASP.net the GirdView Control causes my page to submit twice with one click on any row command button, Why? and how can i fix it





    i'm using a Grid View with a Bound Command field





    %26amp; i have a code that handles the RowCommand event of the GridView





    the problem is during testing the code works fine, but sometims ';NOT ALWAYS'; all of the page events get excuted twice including the RowCommand event, in other words it is same as if the exact page was submitted twice





    this all happens when i click on the command field of the GridView ';SOME TIMES';





    dont tell me to use the Page.isPostBack because the page i'm constructing wroks as a post back page .. not to mention that the exact page is submitted twice for one actual submit





    if there is anyone with a clue, i would appreciate it !!In ASP.net the GirdView Control causes my page to submit twice with one click on any row command button, Why?
    Please post your markup for the GridView and the code for your Page_Load and GridView's RowCommand event handler.





    I've seen similar things in the past, but it's almost impossible to diagnose the problem without code.








    ---





    Although I don't like the GridView's framework for commands, I think it is superior to the original DataGrid. Here's what I usually do:





    (inside the %26lt;Columns%26gt; of the GridView)


    %26lt;asp:TemplateField%26gt;


    %26lt;ItemTemplate%26gt;


    %26lt;asp:ImageButton runat=';server'; ImageUrl=';~/images/delete.gif'; CommandArgument='%26lt;%# Eval(';Identifier';) %%26gt;' OnCommand =';DeleteEmployee_Command'; /%26gt;


    %26lt;/ItemTemplate%26gt;


    %26lt;/asp:TemplateField%26gt;





    (in the codebehind)





    protected void DeleteEmployee_Command (Object sender, CommandEventArgs e)


    {


    // e.CommandArgument holds the identifier (primary key) of the record i want to delete


    }In ASP.net the GirdView Control causes my page to submit twice with one click on any row command button, Why?
    You do not need to specify the OnRowCommand if you have the autoEventWireUp = true.

    ASP.NET problem:';Parameter @lab not supplied';error even after selectparameters.add called...how do I fix this?

    Here's my code, which calls a stored proc named insertlab with two parameters: @lab and @fake. Ways to prevent the error?





    %26lt;%


    Dim c As Parameter


    Dim d As Parameter


    c.Name = ';@lab';


    c.Type = TypeCode.String


    c.DefaultValue = ';trylab';


    SqlDataSource2.SelectParameters.Add(c)


    d.Name = ';@fake';


    d.Type = TypeCode.String


    d.DefaultValue = ';trylab';


    SqlDataSource2.SelectParameters.Add(d)


    %%26gt;


    %26lt;form id=';form2'; runat=';server';%26gt;


    %26lt;asp:GridView ID=';GridView2'; runat=';server'; AutoGenerateColumns=';True'; DataSourceID=';SqlDataSource2';%26gt;


    %26lt;/asp:GridView%26gt;


    %26lt;asp:SqlDataSource ID=';SqlDataSource2'; runat=';server'; ConnectionString=';Data Source=X;Initial Catalog=complab;User ID=X;password=X';


    ProviderName=';System.Data.SqlClient'; SelectCommand=';insertlab'; SelectCommandType=';StoredProcedure';%26gt;


    %26lt;SelectParameters%26gt;


    %26lt;/SelectParameters%26gt;


    %26lt;/asp:SqlDataSourceASP.NET problem:';Parameter @lab not supplied';error even after selectparameters.add called...how do I fix this?
    Its probably because you're not creating an instance of the parameter. Try adding the new keywork when declaring the parameter i.e. Dim c As New SqlParameter. For more information take a look at this web site.





    http://www.macronimous.com/resources/cal鈥?/a>





    Hope this helps

    Maintain scroll on post back?




    I have to maintain scroll position after transfering from one page to another. I have a panel with gridview in my aspx page.when I select my 40th row of the gridview it will transfer to next page. When I come back to the page the panel scroll will be in the same position, not at the top.





    In my googling, one hidden field will store the panel position and this value will be assigned to the panel.





    But how to do this.


    Any one guide me





    Thanks in advance.Maintain scroll on post back?
    Know about Information Technology %26amp; Programming


    at


    http://informationinit.blogspot.com/

    Asp.net question....sorting question with a label?

    I have a page with an sqldatasource and a gridview that lets me sort from four different columns. i'm supposed to have a label below that that shows ';Sorted by.....XXX'; XXX being whatever sort is chosen.





    How do I make the label change depending on the sort?Asp.net question....sorting question with a label?
    is it a label or a literal? i thought you could only work with literals in asp.net. set a simple variable like


    int sort = 0;


    0 is low price


    1 is sorted with highest price first


    2 is popularity etc. and then a bunch of if statements like


    if (sort == 0)thisLiteral.Text=';Lowest Price';;

    Binding data to a textbox control in asp.net?

    Can anyone please how do we bind data to a textbox.


    i knw hw do it in gridview n all...Binding data to a textbox control in asp.net?
    You just set its Text property like this:





    MyTextBox.Text = ';This is my string';;





    Hope this helps.

    How can I stop ASP .NET 2.0 caching my datagrid?

    I have a form that I am using to post data to a database table and a gridview on the same page that is displaying the data.





    When I post the data, the grid view is not updated until I manually reload the page.





    I know that the whole page is not being cached becuase I have printed the current time and this changes when the form is submitted.How can I stop ASP .NET 2.0 caching my datagrid?
    You see the page is not being cached, but the data is being loaded from ViewState. Make sure you refresh the GridView after updating the DataSource.





    private void Page_Load( ... ) {


    if(!Page.IsPostBack() {


    BindGridView();


    }


    }





    private void BindGridView() {


    //set DataSource of your GridView


    //call the DataBind() method of your GridView


    }





    //call the BindGridView() method whenever you update your DataSource








    Hope this helps.How can I stop ASP .NET 2.0 caching my datagrid?
    This may be of interest to you :


    http://msdn.microsoft.com/msdnmag/issues鈥?/a>
    Make sure the method that populates the GridView is being executed when the page posts back and not just on first load.
  • web hosting talk
  • loan
  • How to display information from database in pop up using AJAX in asp.net ?

    hi .. i have a GridView control having employee imformation ,i wanted to display more imformation in pop up when mouse is over the employee code field in GridView, ?i am working in ASP.NET Enviroment plse help me it's urgent requirementHow to display information from database in pop up using AJAX in asp.net ?
    For AJAX (as was said before being the client side code) to be able to get the info and display it you will need server side script to process AJAX request, get the info, format it in XML format and send it back to the client...How to display information from database in pop up using AJAX in asp.net ?
    Hello,





    A lot of 'modern' browsers block out popups, or put them behind the active window. Also, you'd have to be careful to avoid multiple window.opens every time the user moves the mouse...





    You can make popup menus without any Javascript (using CSS)... but they only work well in those 'modern' browsers already mentioned.





    If using Javascript, look at moving and hiding/showing some 'menu HTML', or if appropriate, creating such a menu dynamically..





    The code below is gratuitously commented, and has been tested on Opera 9, Firefox 2, and IE6. It will let you assign different menus to multiple objects; but the menus don't disappear very cleanly... You can hack the Javascript around to do things like, alter the position of the popup relatively, so it appears 'from' the parent element rather than over it; or even at the position of the mouse exactly. You also might want to make the popups disappear automatically when the user mouses out of the vicinity of the popup... I'll leave that to you to research:





    %26lt;!DOCTYPE html PUBLIC ';-//W3C//DTD XHTML 1.0 Transitional//EN'; ';http://www.w3.org/TR/xhtml1/DTD/xhtml1-鈥?br>

    %26lt;html%26gt;


    %26lt;head%26gt;


    %26lt;title%26gt;Simple PopupMenu%26lt;/title%26gt;





    %26lt;style type=';text/css';%26gt;


    /*Important style definition is 'position:absolute'. Means the element can


    be placed at an arbitrary position without affecting the flow of surrounding


    elements*/


    .popup


    {


    position:absolute;


    border:solid 1px black;


    background-color:white;


    padding:4px;


    }


    %26lt;/style%26gt;





    %26lt;script type=';text/javascript';%26gt;


    //findPos function is from http://www.quirksmode.org/js/findpos.htm鈥?/a>


    //where its workings are explained in more detail.


    function findPos(obj) {


    var curleft = curtop = 0;


    if (obj.offsetParent) {


    curleft = obj.offsetLeft


    curtop = obj.offsetTop


    while (obj = obj.offsetParent) {


    curleft += obj.offsetLeft


    curtop += obj.offsetTop


    }


    }


    return [curleft,curtop];


    }





    //Display a named menu, at the position of another object


    function display_menu(parent,named)


    {


    //get the named menu


    var menu_element = document.getElementById(named);


    //override the 'display:none;' style attribute


    menu_element.style.display = ';';;


    //get the placement of the element that invoked the menu...


    var placement = findPos(parent);


    //...and put the menu there


    menu_element.style.left = placement[0] + ';px';;


    menu_element.style.top = placement[1] + ';px';;


    }





    //Hide a named menu


    function hide_menu(named)


    {


    //get the named menu


    var menu_element = document.getElementById(named);


    //hide it with a style attribute


    menu_element.style.display = ';none';;


    }


    %26lt;/script%26gt;


    %26lt;/head%26gt;


    %26lt;body%26gt;





    %26lt;!--Define the menu's contents. It's important to put the display:none style attribute


    here rather than in a %26lt;style%26gt; block, because it can be overriden easily if it's assigned here--%26gt;


    %26lt;div class=';popup'; id=';menu1'; style=';display:none;';%26gt;


    %26lt;ul%26gt;


    %26lt;li%26gt;%26lt;a href=';#';%26gt;Menu 1%26lt;/a%26gt;%26lt;/li%26gt;


    %26lt;li%26gt;%26lt;a href=';#';%26gt;Menu 2%26lt;/a%26gt;%26lt;/li%26gt;


    %26lt;li%26gt;%26lt;a href=';#';%26gt;Menu 3%26lt;/a%26gt;%26lt;/li%26gt;


    %26lt;/ul%26gt;


    %26lt;!--Hide the menu when the text (Close popup) is clicked--%26gt;


    %26lt;span onclick=';hide_menu('menu1');';%26gt;(Close popup)%26lt;/span%26gt;


    %26lt;/div%26gt;





    %26lt;!--Mouseovering on this element will show the menu with id 'menu1', at the position of {this}, that is


    this element--%26gt;


    %26lt;a href=';#'; onmouseover=';display_menu(this,'menu1');鈥?on hover%26lt;/a%26gt;


    %26lt;p%26gt;


    Other text here, should not be obscured on pops.


    %26lt;/p%26gt;


    %26lt;p%26gt;


    Other text here, should not be obscured on pops.


    %26lt;/p%26gt;


    %26lt;p%26gt;


    Other text here, should not be obscured on pops.


    %26lt;/p%26gt;


    %26lt;a href=';#'; onmouseover=';display_menu(this,'menu1')';鈥?on hover%26lt;/a%26gt;





    %26lt;/body%26gt;


    %26lt;/html%26gt;





    This should hopefully answer your question. Good Luck!





    Sean Colicchio


    Server Engineer


    Host My Site


    http://www.hostmysite.com/?utm_source=bb
    AJAX is client code.

    How do I send value to the next page in ASP.net?

    I am using a Gridview on the first page.


    Inside the Gridview, there is a column with hyperlinks.


    I want that when I select the hyperlink, the next page knows I have make the selection and load only the selection I made.


    How do I go about doing that in ASP?


    I have heard about sending value and using session?





    Any clue on what to do and any websites that can prove to be useful on these?How do I send value to the next page in ASP.net?
    There are several ways to share data between pages.





    One of them is Session Variables. Another way is sending the parameter through GET (in a queryString).





    %26lt;a href=';MyPage.aspx?id=1';%26gt;Click Here to go to my page %26lt;/a%26gt;





    in the MyPage load you can read the value of the id like this:





    int id;


    if(Request.QueryString[';id';] != null){


    id = int.Parse (Request.QueryString [';id';] ) ;


    }How do I send value to the next page in ASP.net?
    in hyperlink when u set url i mean to say navigate url or postback url. at that time also add the query string


    like


    Postbackurl=';../text.aspx?SelectionID=鈥?Id]';


    you can set this [your id] with Datbinder.eval,





    else you can create whole thing in itemdatabound event.





    Ketan Raval


    http://ketanravalitleadership.blogspot.com/


    http://ketanravalnurture.blogspot.com/


    http://ketanbiodata.blogspot.com/

    Can i select two attributes and display them as one column in the gridview using sql statement? Part 2?

    i still cant figure it out....





    ';SELECT [LastName] 'Name' FROM [User]';;





    how to display both the LastName and FirstName at the same time?Can i select two attributes and display them as one column in the gridview using sql statement? Part 2?
    Under oracle it works like this:





    SELECT LastName || Name FROM Users;





    or





    if you want to add your own string:





    SELECT 'your own string' || LastName || Name FROM Users;Can i select two attributes and display them as one column in the gridview using sql statement? Part 2?
    SELECT [FirstName] + ' ' +[LastName] AS [Name] FROM [User]
    ';SELECT LastName + ', ' + [Name] FROM [User];';;

    How to update particular row in gridview in Asp.net 2.0 in 3 tier architecture?

    %@ Page Language=';C#'; %%26gt;


    %26lt;!DOCTYPE html PUBLIC ';-//W3C//DTD XHTML 1.1//EN';


    ';http://www.w3.org/TR/xhtml11/DTD/xhtml1鈥?br>

    %26lt;script runat=';server';%26gt;


    %26lt;/script%26gt;


    %26lt;html %26gt;


    %26lt;head runat=';server';%26gt;


    %26lt;title%26gt;Untitled Page%26lt;/title%26gt;


    %26lt;/head%26gt;


    %26lt;body%26gt;


    %26lt;form id=';form1'; runat=';server';%26gt;


    %26lt;div%26gt;


    %26lt;asp:SqlDataSource ID=';productsDataSource'; Runat=';server';


    ';SelectCommand=';SELECT [ProductID], [ProductName], '; %26amp; _


    ';[QuantityPerUnit], [UnitPrice], [UnitsInStock] '; %26amp; _


    ';FROM [Products]';


    ConnectionString=


    ';%26lt;%$ ConnectionStrings:NWConnectionString %%26gt;';


    DataSourceMode=';DataReader';%26gt;


    %26lt;/asp:SqlDataSource%26gt;


    %26lt;asp:GridView ID=';productGridView'; Runat=';server';


    DataSourceID=';productsDataSource';


    DataKeyNames=';ProductID'; AutoGenerateColumns=';False';%26gt;


    %26lt;Columns%26gt;


    %26lt;asp:BoundField ReadOnly=';True';


    HeaderText=';ProductID'; InsertVisible=';False';


    DataField=';ProductID';


    SortExpression=';ProductID';%26gt;%26lt;/asp:BoundFi鈥?br>

    %26lt;asp:BoundField HeaderText=';ProductName';


    DataField=';ProductName';


    SortExpression=';ProductName';%26gt;%26lt;/asp:Bound鈥?br>

    %26lt;asp:BoundField HeaderText=';QuantityPerUnit';


    DataField=';QuantityPerUnit';


    SortExpression=';QuantityPerUnit';%26gt;%26lt;/asp:B鈥?br>

    %26lt;asp:BoundField HeaderText=';UnitPrice';


    DataField=';UnitPrice'; SortExpression=';UnitPrice';%26gt;


    %26lt;/asp:BoundField%26gt;


    %26lt;asp:BoundField HeaderText=';UnitsInStock';


    DataField=';UnitsInStock';


    SortExpression=';UnitsInStock';%26gt;%26lt;/asp:Boun鈥?br>

    %26lt;/Columns%26gt;


    %26lt;/asp:GridView%26gt;





    %26lt;/div%26gt;


    %26lt;/form%26gt;


    %26lt;/body%26gt;


    %26lt;/html%26gt;How to update particular row in gridview in Asp.net 2.0 in 3 tier architecture?
    You might find this page useful:


    http://msconline.maconstate.edu/tutorial鈥?/a>

    How to make gridview row scroll?

    i want to apply scroll bar on row and make header studyHow to make gridview row scroll?
    THis should help:





    Is it possible to make gridview's header row always visible when I ...


    Is it possible to make gridview's header row always visible when I scrolling down the page?? Last post 06-01-2006 11:12 PM by pstanhope. 1 replies. ...


    forums.asp.net/t/995880.aspx - 35k - Cached - Similar pages - Filter





    CodeProject: GridView Redux. Free source code and programming help


    Jan 9, 2006 ... Follow these steps to make the GridView - Add New Records ..... It's hard to freeze the headers, while letting the detail rows scroll. ...


    www.codeproject.com/KB/webforms/GridVi鈥?- 117k - Cached - Similar pages - Filter





    Programmatically position gridview/table scrolling : gridview


    Any suggestions on how to make this work would be appreciated. .... You just need to access a control within the row of the GridView and execute that ...


    www.experts-exchange.com/Programming/L鈥?- 66k - Cached - Similar pages - Filter





    Matt Berseth: ModalPopupExtender Example for Editing Rows in a ...


    Jul 10, 2007 ... ModalPopupExtender for Editing Rows in a GridView (Master/Deta .... For all that wanted to know how to get it to scroll back to the top. ...


    mattberseth.com/blog/2007/07/modalpopu鈥?- 97k - Cached - Similar pages - Filter





    TheMSsForum.com %26gt;%26gt; Asp %26gt;%26gt; asp.net 2.0 gridview scrolling text in ...


    Feb 6, 2008 ... Re: asp.net 2.0 gridview scrolling text in one column by Eliyahu. Eliyahu Wed Feb 06 03:31:16 CST 2008 You can make this column templated ...


    www.themssforum.com/Asp/aspnet-gridvie鈥?- 71k - Cached - Similar pages - Filter





    GridView full row select %26amp; event


    What is the easiest way to scroll to a certain row? thanks. In GridView, when I select or edit a row programatically, how can I scroll to that row? thanks! ...


    www.aspspider.com/rss/Rss34305.aspx - 39k - Cached - Similar pages - Filter





    making a gridview scroll


    Dec 3, 2007 ... how to make a gridview scroll. can we do it with div i want to see the big gridview ... Previous : GridView Row 路 Return to Discussion Forum ...


    www.dotnetspider.com/forum/ViewForum.a鈥?- 17k - Cached - Similar pages - Filter





    Exploring GridView Control Events


    GridViewRow gridViewRow ); // Access the row to be deleted public System.Windows. .... cell content when the current cell changes as a result of scrolling ...


    msdn.microsoft.com/en-us/library/ms993鈥?- 47k - Cached - Similar pages - Filter





    Gridview doubleclick to select the row


    May 4, 2006 ... I think double clicking the row would make their lives easier. ... click on the row, rather than scrolling back and forth for the button. ...


    www.velocityreviews.com/forums/t123736鈥?- 33k - Cached - Similar pages - Filter





    Interface Technical Training Blogs - Dan Wahlin's Blog - Freeze ...


    The code basically grabs the first header row from the GridView using JavaScript and moves it ... Used to create a fixed GridView header and allow scrolling ...


    blogs.interfacett.com/.../2007/7/31/fr鈥?- 41k - Cached - Similar pages - Filter

    How do i add scroll bar to gridview (asp.net 2.0) from code (server side)?

    ...for vertical:





    dgvYourDataGridView.ScrollBars = ScrollBars.Vertical;





    ...for horizontal:


    dgvYourDataGridView.ScrollBars = ScrollBars.Horizontal;





    ...for both:


    dgvYourDataGridView.ScrollBars = ScrollBars.Both;How do i add scroll bar to gridview (asp.net 2.0) from code (server side)?
    Amazing I didn't find any property ';ScrillBars'; associated with GridView Control????????

    Report Abuse


    How do i add scroll bar to gridview (asp.net 2.0) from code (server side)?
    One way is to add the gridview to an asp:Panel control, and set the desired Width and Height for the Panel with ScrollBars property set to Vertical.





    E Screw
  • web hosting talk
  • loan
  • How to display subscript n superscript in gridview+c# in window forms?

    Sorry . No idea

    ASP.NET. VB.NET: How to access value of checkbox field in the gridview control.?

    I have pulled data from SQL Server into a GridView control.


    Two of the columns are checkbox fields.





    During run-time,I am to click those columns to enter a check.


    But how can I find out if the values of those items during run-tim





    I need to allow the user to indicate whether they approve or deny a request; and then, I shall be able to update the corresponding columns in the originating database table.





    What must I do to solve this problem?





    During run-time, I added these two columns to the already existing ones:





    [code]





    Dim myCol1 As New DataColumn(';Approved';)


    Dim myCol2 As New DataColumn(';Denied';)





    myCol1.DataType = System.Type.GetType(';System.Boolean';)





    myCol2.DataType = System.Type.GetType(';System.Boolean';)





    myDataSet.Tables(0).Columns.Add(myCol1鈥?br>

    myDataSet.Tables(0).Columns.Add(myCol2鈥?br>

    myDataSet.Tables(0).AcceptChanges()


    [/code]





    I have code in myGridView_RowUpdating():





    [code]





    Try


    'For Each column As GridViewRow In myGridView.Rows(myGridView.EditIndex)


    ' Access the CheckBox


    'Dim cb As CheckBox = column.FindControl(';Approved';)





    'Perhaps could also check to see if the index of the row equals myGridView.EditIndex


    For Each row As GridViewRow In myGridView.Rows


    ' Access the CheckBox


    Dim cb As CheckBox = row.FindControl(';Approved';)








    If cb IsNot Nothing AndAlso cb.Checked Then


    Console.WriteLine(';Found';)





    'Here, I want to see if the Approved checkbox is checked.





    End If


    Next


    Catch ex As Exception


    Console.WriteLine(ex.Message)


    End Try[/code]








    This is the code that I placed in myGridView_RowCommand():





    [code]





    Static intCount As Integer


    Dim intRowIndex As Integer








    'If intCount = 0 Then


    intRowIndex = CInt(e.CommandArgument.ToString())


    'dim intColumnIndex as Integer = cint(Request.Form([';__EVENTARGUMENT';])





    myGridView.EditIndex = intRowIndex 'Place this particular row of the GridView control in edit mode.





    intCount += 1


    'End If 'If intCount = 0





    Dim intResponse As Integer


    Dim strAnswered As String








    If (e.CommandName.Equals(';Edit';)) Then





    ElseIf (e.CommandName.Equals(';Update';)) Then


    Console.WriteLine(';Update';)





    ' If myGridView.Rows(intRowIndex).Cells.Item(鈥?And myGridView.Rows(intRowIndex).Cells.Item(鈥?Then





    ' End If





    'intResponse = MsgBox(';Are you sure that you want to approve this request?';, MsgBoxStyle.YesNoCancel, ';Confirmation Required';)


    ElseIf (e.CommandName.Equals(';Cancel';)) Then





    Else


    'Nada


    End If 'If (e.CommandName.Equals(';Edit';))





    If intResponse = vbCancel Then


    MsgBox(';The record has not been changed.';, MsgBoxStyle.OkOnly, ';No Action Taken';)








    Exit Sub


    End If





    If intResponse = vbYes Then


    'Retreive the value of the key





    Dim strKey As String








    'strKey = myGridView.DataKeys(intRowIndex).Values(鈥? 'Oops! There has been nothing assigned to DataKeys.





    'Note: myGridView.Rows(intRowIndex).Cells.Item(鈥?is ';';, since it is the column of DELETE buttons.





    'This gives the contents of the first row, first column. It would have been Cells.Item(0), had it not been


    ' displaced by the row of EDIT buttons.


    strKey = myGridView.Rows(intRowIndex).Cells.Item(鈥?br>




    'Call the handling routine, with strKey as a parameter.


    'SupervisorResponse(strKey)


    End If 'If intResponse = vbYes


    [/code]ASP.NET. VB.NET: How to access value of checkbox field in the gridview control.?
    from code I have doing the same type of thing but going after a textbox





    Dim item as DataGridItem


    foreach item in DataGridCart.Items


    cartInfo = cartController.Get(CInt(DataGridCart.Dat鈥?br>

    cartInfo.Quantity = Convert.ToInt32((directcast(item.Cells(3鈥?br>

    next





    The code was converted to VB for you from CSharp on the fly...but that's the basic idea.ASP.NET. VB.NET: How to access value of checkbox field in the gridview control.?
    http://it.maconstate.edu/tutorials/

    How can we select data from SQL Server to GridView fastly.?

    How can we select data from SQL Server to GridView fastly. I have to show 2000 records at a time. I am using a procedure which has cursors and is quite slow on hostingHow can we select data from SQL Server to GridView fastly.?
    Use Stored Procedure and for getting data use indexes clustered and also non clustrere.


    As per paging issue gridview show only 1000 records per pageHow can we select data from SQL Server to GridView fastly.?
    I'd advise to change your code. Cursors aren't usually the only way of performing a task and they have massive overheads.





    Can you post your code or what you're wanting to do so we can see if it can be done another way?





    *EDIT*





    Hi again Sam, looks like you've run out of space on the additional info. If you want to email me the cursor I'll try and have a look at it over christmas.





    My emails filetransferboy @ yahoo.co.uk
    hello frnd simple use store procedure for this





    -- ========================================鈥?br>

    -- Template generated from Template Explorer using:


    -- Create Procedure (New Menu).SQL


    --


    -- Use the Specify Values for Template Parameters


    -- command (Ctrl-Shift-M) to fill in the parameter


    -- values below.


    --


    -- This block of comments will not be included in


    -- the definition of the procedure.


    -- ========================================鈥?br>

    SET ANSI_NULLS ON


    GO


    SET QUOTED_IDENTIFIER ON


    GO


    -- ========================================鈥?br>

    -- Author: %26lt;Author,,Name%26gt;


    -- Create date: %26lt;Create Date,,%26gt;


    -- Description: %26lt;Description,,%26gt;


    -- ========================================鈥?br>

    CREATE PROCEDURE SP_SelectData


    as





    select * from tbl_name





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








    and call with code and use datatable object for this and bind it .


    more help mail me madangdhiman@yahoo.co.in
    The use of a cursor is absolutely no needed. Cursors will slow down your code.





    Write the Procedure as such


    CREATE PROC GetEmployee


    ( @prmEmpId int )


    AS


    SELECT * FROM Employee WHERE ID = ISNULL(@prmEmpId, ID)





    The complete guide that teaches you to display the record set in a gridvew is here:





    http://msdn.microsoft.com/en-us/library/鈥?/a>





    Hope this helps.

    Edit Gridview in code behind?

    I am dynamically adding some gridviews to a page and need to allow them to be editable. How can I do this in the code behind? I tried to set gv.Rows(0).RowState = DataControlRowState.Edit but its not working. I am trying to allow the users to edit, when the labels turn to textboxes, and the cancel/save buttons appear. Is there any function for this or do I have to add all the controls one by one?Edit Gridview in code behind?
    wll u didnt specify abt .net framework





    in 2005 it can be easily done while you initialize the objects dynamically sets the property allow editing, edit command and insert command and delete command as well if u want but in 2003 you have to create delegates for that edit buttons to function properly and code there





    last rank my answer n provide more details of ur questin


    so that i can properly help u

    Can someone help me figure out how to pass unique ID of one gridview to another?

    Hello there!


    On my first page (called Home.aspx) I have a gridview that has a column that uses button for the user to click on and be directed to page 2 (called BookReviews.aspx). I do have it set up %26amp; working where the user clicks on a button in the gridview on Home.aspx and through a session variable it passes the bookID to display in a label on BookReviews.aspx. However, the problem is I would like ALL the bookReviews for that given bookID to be displayed in a gridview on BookReviews.aspx. I am not sure how I should go about doing this. Thanks for your help in advance!





    **Book Table**


    bookID


    bookName





    **Book Reviews**


    bookID


    bookReviewID


    bookReviewDescription


    bookReviewUserName





    .......and this is what I have on my second page so far....





    protected void Page_Load(object sender, EventArgs e)


    {





    if (!Page.IsPostBack)


    }


    labBookId.Text = Session[';bookID';].ToString();


    labBookReviewDesc.Text = Sessoin[';bookReviewDescription';].ToStrin鈥?br>

    {





    }Can someone help me figure out how to pass unique ID of one gridview to another?
    You can tell then button to send the id of ther record you have selected in the gridview. This can then be passed via querty string or session id to the next page by using a Response.Redirect





    http://msdn2.microsoft.com/en-us/magazin鈥?/a>





    That link should give you more info about using gridviews.





    A more elegant way would be to use the details view grid on the same page.Can someone help me figure out how to pass unique ID of one gridview to another?
    You can still hide the gridview and display the list in a repeater all on the same page. As in the other answer either use it in a querrystring in the url or pass it as a session variable.

    How to print gridview data in pdf form.?

    Java has many Open Source projects for pdf writer, which includes Jasper Reports, and iReport is part of Jasper's project. Java Servlets written for JavaEE also. So, if you're working in C# or SQL, maybe there is answer for PDF keeping your project in those frameworks.





    just google


    java pdf writer
  • web hosting talk
  • loan
  • How to delete row on a gridview using ASP .NET?

    Im using Visual Web developer 2008 express edition. The database that Im using is MS Access. I can insert and select.





    The problem is when i view the database thru Gridview I have a commandfield that delete a certain record.





    I use parameter for my deletecommand on my datasource. but i always got this error:





    ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.How to delete row on a gridview using ASP .NET?
    You haven't specified the identifier used to delete the record. Post your grid and datasource code here.





    The paramwing is not a datakey nor is it a column. Try adding it as a datakey or a bound column then hide it.

    How to print out sql statement in asp.net 2.0 Gridview?

    I 'd like to print out the print out sql statement in asp.net 2.0 Gridviewprint out sql statement in asp.net 2.0 Gridview. Tried to use SqlDataSource1.UpdateCommand, but it doesn't print out the values of parameters.


    thanks,How to print out sql statement in asp.net 2.0 Gridview?
    You can catch the code before the update in the SqlDataSource.Updating Event. Open the SqlDataSource1 properties window and double-click in the Updating field. Write this code (or similar):





    protected void SqlDataSource1_Updating(object sender, SqlDataSourceCommandEventArgs e)


    {


    string strSQL = SqlDataSource1.UpdateCommand;


    foreach(DbParameter parameter in e.Command.Parameters)


    {


    strSQL = strSQL.Replace(


    parameter.ParameterName,


    parameter.Value.ToString());


    }


    lblSQL.Text = strSQL;


    }





    For string types, you may want to wrap the value in single quotes depending on whether you are actually going to run this SQL against the database once you retrieve it.

    ASP.NET : GridView : Adding two dropdown boxes?




    I have this problem that I really want someone to help me with.





    I have a GridView that should show some data (name, country and city).





    When editing, I have configured the Country and City to display their data in dropdown boxes. And it's working fine. The countries and cities dropdowns retrieve their data from two tables called Countries and Cities.





    My problem is, how can I link the Country to the City ! I mean, when I try to change the country, I want the cities to be updated so that I can see only relevant cities to the selected country.





    I have searched a lot for a solution, with no hope !





    Can anyone help?





    If you can, just explain with Code .. Or e-mail me the solution on yasserhy AT yahoo.com ..





    Thank youASP.NET : GridView : Adding two dropdown boxes?
    My guess would be that you would have to have individual tables for each Country. For example US, Mexico, and Canada would have their own cities in a table. Then you may have to write an if statement for where the Cities drop down is getting the data from. I haven't coded in a while but that's how I would do it.





    If it's SQL you could write a query to pull from the Cities table where Country is XXXXX. That would pull only the cities from the Country specified from the Countries drop down.

    Can an ASP.net gridview be verticle aligned?

    I have a table:





    header1 header2 header3


    data11 data12 data13


    data21 data22 data23


    data31 data32 data33





    How can I make it like this:


    header1 data11 data21 data31


    header2 data12 data22 data32


    header3 data13 data23 data33





    its like this, I have 20 or so headers, and want to show a comparison between 3 datas. So for comparison I need to generate the table verticley not horizontally.





    it should be a simple align command but I dont see anything in the control itself to change this. Any help is appreciated.Can an ASP.net gridview be verticle aligned?
    The below article exaplains how you can do it.





    Hope it helps.

    How to retrive data in gridview from ms access in vb.net ?

    require source code .i m B.C.A studentHow to retrive data in gridview from ms access in vb.net ?
    http://answersin.frasesde.com


    A very informative website, kindly stay a minute in website and enter you email address for getting your answer.How to retrive data in gridview from ms access in vb.net ?
    here is the code


    http://www.codeproject.com/KB/database/msdatagridoledb.aspx





    register yourself and download the code.
  • web hosting talk
  • loan
  • How do i select a gridview row, send it to another page, then update it, and return it to the gridview?

    I guess you are talking about in Visual Studio. What you need to do is in the GridView page use the code similar to this to pick up one of the unique fields ( like product number in this example is row 1) and then send it to a new page ( in this example it's a page called ProductForm ) :





    =======


    Protected Sub gvProducts_


    SelectedIndexChanged_


    (ByVal sender As Object, ByVal e As System.EventArgs) _


    Handles gvProducts.SelectedIndexChanged


    Dim strMovexCode As String


    strMovexCode = _


    Trim(gvProducts.SelectedRow._


    Cells(1).Text)


    Response.Redirect(';ProductForm.aspx?pcp=鈥?%26amp; strMovexCode)


    End Sub


    =======





    I have added this so that it runs when you select an item in the gridview but you can instead add it to a button if you want.





    Then, in your page ( ProductForm in this example ) add the following to the Page Load to bring up the information in a field ( PRODUCT_CODE in this example ):





    =======


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


    If Not Page.IsPostBack Then


    If Request.QueryString(';pcp';) %26lt;%26gt; ';'; Then


    txtPRODUCT_CODE.Text = Request.QueryString(';pcp';)


    End If


    End If


    Form.DataBind()


    End Sub





    =======





    Sorry this is hard to explain but I hope that this helps. At least you will now have the keywords to search on.How do i select a gridview row, send it to another page, then update it, and return it to the gridview?
    You need more detail in your question. What application is this?

    Gridview - Bind Object Array. .NET 2.0?

    I'm going to make this as least confusing as possible..it's kind of hard to explain though.





    I have a shopping cart that's stored into session. I have a gridview on an aspx page that i want to bind this full shopping cart to.





    The shopping cart is an object of a class cart.cs. This class basically contains an arraylist of other objects (items.cs).





    items.cs refers to each individual product added to the cart. it has 2 fields: a products object (that contains all relevant information to that product in it's properties) and an integer quantity value.





    So, the hierarchy is something like this:





    Session[';Cart';] --%26gt; Cart (arraylist of items) --%26gt; items (includes product object and quantity value) --%26gt; product object (contains all relevant information to that product.





    How can I get this into a gridview on binding from the backend?





    Any help is appreciated greatly.Gridview - Bind Object Array. .NET 2.0?
    The object that you are binding must implement the IListSource interface.

    Gridview in asp.net 2.0?

    i have a gridview with column name orderid, orderdate, quantity and totalprice. but when i try to update the quantity the price can't be update.


    example: quantity = 2 totalprice = $120 but when i update to quantity = 3 , the totalprice still $ 120. so how to solve it ?Gridview in asp.net 2.0?
    You need to assign an onrowupdated event for your GridView and have a subroutine / function compute the new value for you.





    http://msdn2.microsoft.com/en-us/library鈥?/a>

    How do I allow ASP send my hyperlink selection to the nextpage such that the nextpage display only my selectio

    I am working with Gridview in both of my ASP page.How do I allow ASP send my hyperlink selection to the nextpage such that the nextpage display only my selectio
    Your question doesn't make sense. It doesn't have enough information to figure out what you're doing.

    Nested gridview in asp.net?

    how to nest gridview inside gridviewNested gridview in asp.net?
    You can have a gridview inside of the template column of another gridview. This link may help: http://www.vbdotnetheaven.com/UploadFile/nikhil_be_it/GridViewInsideGridView05232006004636AM/GridViewInsideGridView.aspx

    Gridview query?

    hey how do i write the syntax for gridview control,if i want to display my table from database using sql server and also using connection string in the gridview ?Gridview query?
    http://authors.aspalliance.com/aspxtreme鈥?/a>


    http://msdn2.microsoft.com/en-us/library鈥?/a>
  • web hosting talk
  • loan
  • How to refresh entire page after gridview is updated?

    Im using VB 2005





    when i updated a row in gridview, or delete a row from gridview, onli the gridview is updated. however any codes outside of gridview will not be refreshed.





    lets say i have a gridview with productname, price,etc





    and a label that displays the Total sum of everything thats in the cart, calling on the method Total()





    however whenever i update or delete something from gridview, only gridview changes. the total only changes once i REFRESH that page manually myself. how do i enable the page to do a refresh whenever a change is done to gridview?





    because in 2005 only the gridview itself updates. nothing else around it. is there a way to make the entire page refresh so page_load can happen again?How to refresh entire page after gridview is updated?
    Hi,


    Write the function in javascript for page refresh.





    function page_reload()


    {


    location.reload();


    }





    then call the javascript when ever the records is update and insert the record.

    Working with a gridview in vb.net?

    i have a grid view and would like to change some things around with it like the align of the text in the second column. My Code





    gridview.datasoure = mydataset


    gridview.databind


    gridview.column(1).ItemStyle.Horizonta鈥?= HorizontalAlign.Left





    I use 1 becasue 0 is the column with my likebutton.


    I get an error saying 1 is out of the index of my dataview. How can I align this column. Do I have to bind my dataset to the dataview in another way so I can have more contorl over the columns?Working with a gridview in vb.net?
    you might have to use the PROPERTIES WINDOW at DESIGN TIME in order to bind the grid to the recordset to get this working.Working with a gridview in vb.net?
    Sorry, but what do you mean?

    Report Abuse

    Gridview in vb.net?

    I have a gridview and its last colume is a tempate field that is a text box. all the other fields in the gridview are bound to a sqldatasource. So when the view populates all the cells have data exept the textboxes in the template field. I need to be able to pull the text out of the textbox and store it in a string i have tired everything and no matter what it tells me that there is nothing in the textbox. When I but the below code in the textbox event changed it works but i need it to be done in another procedure this is the code I have and it always has my string = ';';.


    dim x as string


    x = ctype(gv1.rows(i).findcontrol(';textbox2';鈥?br>

    x always = '; '; but like i said earlier when i but this code in the text changed even it works x will get the value of what I typed into the apporiate textbox. How can i get it to work in another procedure?Gridview in vb.net?
    check out http://www.pscode.com for great sample codes

    Gridview paging in asp.net?

    i m working on this page with gridview which i flood from my vb code, same adap.fill, gridview.databind(). now i want to page this gridview. while this code http://dotnetjunkies.com/Tutorial/AAF84EAD-C412-4304-A88A-AF26F8C883E6.dcik


    works for a datagrid. i want similar functionality for a gridview. can anyone help??? please its urgent.. my deadline is tom n i've wasted enough time. as in what is the code that goes in pageindexchanged... also if you could type a tiny code showing how rowcommand would work if i were to access the property of an object in my gridview... eg. activate button text to deactivate on clicking....Gridview paging in asp.net?
    The GridView is NOT a DataGrid. If you are using a GridView, then achieving paging is even easier than in a DataGrid. Below I give the code for a page that uses Paging in a GridView.





    I write the whole code inline (in aspx file) to simplify stuff.





    %26lt;%@ Page Language=';C#'; AutoEventWireup=';true'; %%26gt;


    %26lt;%@ Import namespace=';System.Data';%%26gt;


    %26lt;%@ Import namespace=';System.Data.SqlClient';%%26gt;


    %26lt;html %26gt;


    %26lt;head runat=';server';%26gt;


    %26lt;title%26gt;Untitled Page%26lt;/title%26gt;


    %26lt;script runat=';server';%26gt;


    protected void Page_Load(object sender, EventArgs e)


    {


    if (!Page.IsPostBack)


    {


    BindGrid();


    }


    }





    private void BindGrid()


    {


    SqlConnection MyConnection;


    SqlCommand MyCommand;





    MyConnection = new SqlConnection(';server=.;DataBase=Northwi鈥?br>

    MyCommand = new SqlCommand(';SELECT * FROM CUSTOMERS ';, MyConnection);





    DataTable dt = new DataTable();


    SqlDataAdapter da = new SqlDataAdapter(MyCommand);


    MyCommand.Connection.Open();


    da.Fill(dt);


    MyCommand.Dispose();


    MyConnection.Dispose();





    gvwTest.DataSource = dt;


    gvwTest.DataBind();





    }





    protected void gvwTest_PageIndexChanging(object sender, GridViewPageEventArgs e)


    {


    BindGrid();


    gvwTest.PageIndex = e.NewPageIndex;


    gvwTest.DataBind();


    }


    %26lt;/script%26gt;


    %26lt;/head%26gt;


    %26lt;body%26gt;


    %26lt;form id=';form1'; runat=';server';%26gt;


    %26lt;asp:GridView ID=';gvwTest'; runat=';server'; AutoGenerateColumns=';true'; AllowPaging=';true'; PageSize=';10';


    OnPageIndexChanging=';gvwTest_PageIndex鈥? /%26gt;


    %26lt;/form%26gt;


    %26lt;/body%26gt;


    %26lt;/html%26gt;





    Remember.. look for gridView code snippets not DataGrid!!


    Hope the above helps.

    Retreiving data from gridview in asp.net?

    Is it possible to retreive data from gridview database into text boxes in asp.net and if it is then how??





    thanksRetreiving data from gridview in asp.net?
    Try this


    TextBox1.Text = GridView1.Rows[0].Cells[0].Text


    This assigns the value in 1st row 1st column of the gridview to the textbox.

    GridView and DataSets in C#.NET 2.0?

    Can anyone give me an example of how to create a gridview in .cs versus just dragging and dropping the gridview on the aspx page?





    I created a dataset and called a stored procedure using data adapter, but i do not know how to data bind the data set into the grid view I have.





    It seems everywhere I search the gridview examples they have is just dragging and dropping to the page and configuring a datasource.





    Does anyone know how to do it with a data set?GridView and DataSets in C#.NET 2.0?
    //connect to database via dataset %26amp; dataadapter


    SqlConnection con = new SqlConnection(';server=localhost;Initial Catalog=databasename;uid=;pwd=;';);


    DataSet ds = new DataSet();


    SqlDataAdapter da = new SqlDataAdapter(';stored proc name';, con);


    da.SelectCommand.CommandType = CommandType.StoredProcedure;


    da.Fill(ds);





    //create gridview by code %26amp; bind dataset to it


    GridView g = new GridView();


    Page.Controls.Add(g);


    g.DataSource = ds;


    Page.DataBind();GridView and DataSets in C#.NET 2.0?
    Dragging and dropping just sets up some basic properties. Load your dataset with data:





    grid1.DataSource = yourdataset


    grid1.DataMember = yourdataset.datatable (hoisted datatable)


    grid1.AutoGenerateColumns = true (this will automatically set up the columns to bind to your datatable)


    and most importantly


    grid1.Refresh()
    You don't really need to use a DataSet. A Datatable would suffice. You can even only use a SqlDataReader.





    Here is the complete code:


    %26lt;%@ Page Language=';C#'; %%26gt;


    %26lt;%@ Import Namespace = ';System.Data'; %%26gt;


    %26lt;%@ Import Namespace = ';System.Data.SqlClient'; %%26gt;








    %26lt;script runat=';server';%26gt;





    protected void Page_Load( object sender, EventArgs e)


    {


    if ( !Page.IsPostBack ) {


    BindGridView();


    }


    }


    private void BindGridView() {


    using ( SqlConnection cn = new SqlConnection( ';server=.; uid=sa; pwd=; database=Northwind'; ) ) {


    SqlCommand cmd = new SqlCommand( ';GetCustomers'; , cn);


    cn.Open();


    SqlDataAdapter da = new SqlDataAdapter( cmd );


    DataTable dt = new DataTable();


    da.Fill(dt);





    gv.DataSource = dt;


    gv.DataBind();


    }


    }


    %26lt;/script%26gt;





    %26lt;html xmlns=';http://www.w3.org/1999/xhtml';%26gt;


    %26lt;head runat=';server';%26gt;


    %26lt;title%26gt;Untitled Page%26lt;/title%26gt;


    %26lt;/head%26gt;


    %26lt;body%26gt;


    %26lt;form id=';form1'; runat=';server';%26gt;


    %26lt;asp:GridView ID=';gv'; runat=';server'; AutoGenerateColumns=';True';%26gt;


    %26lt;/asp:GridView%26gt;


    %26lt;/form%26gt;


    %26lt;/body%26gt;


    %26lt;/html%26gt;





    To create the stored procedure, simply execute the following T-SQL against the Northwind Sample DB:


    CREATE PROCEDURE GetCustomers AS


    SELECT * FROM Customers





    Hope this helps.
  • web hosting talk
  • loan
  • Asp.net gridView to show data from Excel file...?

    I'm using gridView to show data from Excel file.


    one of the fields is an Email address,the problem is that


    the gridView shows the Email with out the option of clicking


    on it to send mail.


    How can I define the gridView design so that the Email shown can be clickable?





    Thanks


    AsafAsp.net gridView to show data from Excel file...?
    Oh boy, this is a VERY big topic. There are umpteenth ways to do this, and the best way depends on a lot of other stuff you're doing. I suggest you grab a copy of ';Data Binding with Windows Forms 2.0'; by Brian Noyes (Addison-Wesley), it goes into a lot of detail about all the ways to do stuff like this.





    In the mean time, here's how to do it manually. Let's say you've got a table that you're binding to the GridView, I'll use the following code in Page_Load as an example, in your app you're obviously loading it from a spreadsheet:





    if (!this.IsPostBack)


    {


    DataTable table = new DataTable(';Email addresses';);


    table.Columns.Add(';UserName';, typeof(string));


    table.Columns.Add(';Email';, typeof(string));


    table.Rows.Add(';Tom';, ';tom@nospam.com';);


    table.Rows.Add(';Dick';, ';dick@shoo.com';);


    table.Rows.Add(';Harry';, ';harry@dontmailme.com';);


    this.GridView1.DataSource = table;


    this.GridView1.DataBind();


    }





    Open your web page in design mode, select the GridView control and bring up the tasks pane (it's the little right arrow triangle in the upper right hand corner of the control). Now click on Edit Columns and turn Auto-Generate Fields off. Now click the Add button to add a new BoundField column and set the ';Header Text'; and ';DataTextField'; fields to ';UserName';. Create another collumn called ';Email';, but make it of type ';Button Field';.





    Now run your application and you'll notice that text in the Email column can be clicked on and it'll generate a postback. If you want an actual GUI button then go back to the column settings and change the ';ButtonType'; field to ';Button';.





    Finally, you'll need to trap the post-back. Open up the column settings again and add a command to the ';CommandName'; field. If you set it to ';Select'; then you can add a handler to the GridView control's SelectedIndexChanging event and it'll get called whenever the user presses one of the buttons in the email field.





    Good luck!Asp.net gridView to show data from Excel file...?
    You might want to add a ButtonField to the columns collection for the GridView, or merely an achor in a TemplateField.





    You can set the href attribute of the anchor to something like


    %26lt;asp:TemplateField%26gt;


    %26lt;ItemTemplate%26gt;


    %26lt;a href=';mailto:%26lt;%# Eval(';Email) %%26gt;';%26gt; %26lt;%# Eval(';Email) %%26gt; %26lt;/a%26gt;


    %26lt;/ItemTemplate%26gt;


    %26lt;/asp:TemplateField%26gt;





    Hope this helps

    Wednesday, August 11, 2010

    Plz..Plz I need a quick answer for this question about Gridview control...it is very easy?

    I have a gridview control and inside it's template content there is a label .


    this label is databinded to a specific text from the database let's say comment text.





    How can I change some words in this comment before it is displayed ....may be from an event or somewhere else?





    There is no need for sourcecode it is very simple issue and many developers (not me) do it in there web apps.Plz..Plz I need a quick answer for this question about Gridview control...it is very easy?
    Look at hooking into the RowDatabound event. This will allow you to affect the contents of the label programatically before it is displayed...





    You can also call a method on the page such as:





    %26lt;asp:label id=';lblMyText'; runat=';server'; Text='%26lt;%# GetLabelText() %%26gt;' /%26gt;

    How to work with the GridView control in ASP.NET 2.0?

    This article will be very useful to all users who are working with ASP.NET 2.0 GridView control. Here, I will explain how to work with the GridView control in ASP.NET 2.0, which is very easier to use than the DataGrid control in ASP.NET 1.1. I will also explain the differences between the GridView and the DataGrid controls. We will also look into how to work with a template column having a DataGrid inside it.The basic idea behind this article is to see how much the ASP.NET 2.0's GridView control is easier to work than the DataGrid control in ASP.NET 1.1. I have previously worked with the DataGrid control, and I know how difficult it is to work with it in the same project in which I am using the GridView control. Working with the ASP.NET 2.0 GridView control is very easy as it is very user friendly. Though I had faced a lot of difficulties in using it, I can still say it is far better than the DataGrid control. The GridView control gives you Edit, Update, Delete, Sorting, Selection, and Paging functionality built-in.


    Read more on Gridview Inside a GridView in ASP.NET 2.0 at http://www.buzzycode.com/ShowArticles-id鈥?/a>

    How can i connect a gridview component in c#.net to a sql server database table?

    programming with c#.net and sql serverHow can i connect a gridview component in c#.net to a sql server database table?
    http://msdn2.microsoft.com/en-us/library鈥?/a>

    How to print out the sql statement in asp.net 2.0 gridview?

    I 'd like to print the executing sql statement where the databind with asp.net 2.0 gridview. Since in 2.0, the grid view is auto generated, I can' find an explict way to show the running sql statement.





    thanks,How to print out the sql statement in asp.net 2.0 gridview?
    If you configured a gridview with the designer, and you are using a SQLDataSource (named SQLDataSource1 by default):





    Create a label on your page. Say it is:


    %26lt;asp:label runat=';server'; id=';lblSQL';/%26gt;





    In your Page_Load event:





    C#


    lblSQL.Text = SQLDataSource1.SelectCommand;





    VB


    lblSQL.Text = SQLDataSource1.SelectCommandHow to print out the sql statement in asp.net 2.0 gridview?
    That wasn't part of your original question, but if you look at the .aspx code you should see a section under the SQLDataSource named %26lt;SelectParameters%26gt;. You could use this information to perform a replace on the parameter tokens in the SelectCommand with the values.

    Report Abuse

    Asp.Net Help.. How to insert all gridview values into table?

    Loop through Rows collection of GridView control.


    Get values in cells by their index or invoke FindControl method to get controls within ItemTemplate, if you are using TemplateField.


    Now, use ado.net to insert value to table manually.





    For samples visit the links in source :)
  • web hosting talk
  • loan