nakor77 21 Junior Poster in Training

you tell it to cancel from the edit event by calling e.Cancel = true. This allows you to cancel edit mode when the edit was successful or leave it in edit mode if the edit failed.

protected void gvTest_Edit(Object sender, GridViewEditEventArgs e) 
{
    gvTest.EditIndex = e.NewEditIndex;
    Response.Write("Editing...");

    if (successful)
    {
        e.Cancel = true;
    }
    else
    {
        // Display a message or whatever you want to do
        // to let the user know there was a problem
    }
}

Cancel is a property of GridViewEditEventArgs, you can get more information on it from MSDN or by googling it I'm sure. When you are using a datasource control, such as SqlDatasource or EntityDatasource, the Cancel property is set automatically. When you are manually binding the gridview control then you have to tell it when to Cancel.

If you need to cancel within the CancelEdit event you need to do the same thing, set e.Cancel = true.

nakor77 21 Junior Poster in Training

what does myBAL.GetRecord(_myRecord) return? It sounds like a single object, in which case it would not work because the GridView expects a list of items. It needs to return an IEnumerable, List, or something along those lines.

nakor77 21 Junior Poster in Training

are you using the SelectedValue property or the SelectedItem.Text property?

nakor77 21 Junior Poster in Training

Set the autogeneratecolumns property to false

nakor77 21 Junior Poster in Training

this looks like everything is in one page? Where is your code for the second page? How are you trying to load the ListBox on the other page?

nakor77 21 Junior Poster in Training

Why not ask your teacher that question?

nakor77 21 Junior Poster in Training

What is the exact process that you are having problems with? Are you getting some errors that you don't understand? You say you're having trouble which suggests you've made some attempts to get this working on your own, where's your code?

nakor77 21 Junior Poster in Training

what is "latest asp.net projects with abstract"? I really don't think anyone is going to send you every project they've worked on in the last year. If you're asking for something else then you need to make your question a lot more clear.

nakor77 21 Junior Poster in Training

Since you're wanting to run this from a web server your best choices would be either an asp.net webforms application or an asp.net mvc application. Either one should be able to do what you described.

nakor77 21 Junior Poster in Training

where's your code?

nakor77 21 Junior Poster in Training

Be sure that in the page load event you put the databinding of the gridview in a !IsPostBack block. Right now the values in the gridview are getting reset before the button's click event is executed because the page load event occurs before the click event during a postback.

sandesh.ps.9 commented: Thank You. This helped +0
nakor77 21 Junior Poster in Training

If I understand what you're asking correctly then this is how I' would probably go about implementing it. I'd start it with a form for a single row and have a button that the user can click to add additional rows. Use a PlaceHolder control and add the new controls inside of it. This way you can dynamically add as many rows as needed by the user. When they submit the form you can loop through the PlaceHolder's controls property to get all of the controls that the user entered.

nakor77 21 Junior Poster in Training

Can you provide the code for the GridView, where you're databinding it, and the code where you're trying to get the radio button values?

nakor77 21 Junior Poster in Training

If you want to create a chat application in ASP.NET you should really look into Signalr. It's an async library built to specifically handles scenario's like this.

Here's an example of a site using Signalr: JabbR

nakor77 21 Junior Poster in Training

you can always initialize them to 0 just so they have a value and the compiler doesn't throw a fit about unused variables

nakor77 21 Junior Poster in Training

The Music Store is a pretty decent introduction to MVC

nakor77 21 Junior Poster in Training

It's almost always a good idea to maintain a separation of concerns. It generally makes the troubleshooting process easier. If you need to change your data access you should be able to update your data access layer and not make changes to the rest of your application. The same he's for any other logical layers your application may include.

nakor77 21 Junior Poster in Training

You can ask questions. Please provide the code you have a question about along with any exceptions you are getting, or the results you are getting compared to what you think should be happening.

nakor77 21 Junior Poster in Training

Is there a question in there that I'm missing?

nakor77 21 Junior Poster in Training

that kind of depends on what you're using as a datasource for your gridview. If you're using a datasource control such as a SqlDatasource or LinqDatasource it can usually be set to handle the insert operation. If you're handling all of the code on the back end then just do an insert using a SqlCommand object.

nakor77 21 Junior Poster in Training

you can do

while (!Name.Equals("himanshu", StringComparison.OrdinalIgnoreCase))
{
    // do something
}

That will compare your string variable to a string and ignore the case of the strings. Here's a link to Microsoft's "Best Practices for Using Strings"

nakor77 21 Junior Poster in Training

Let me try to get some clarification. You're wanting to access the value in a control on one page, let's call it pageA.aspx, from a completely different page, pageB.aspx? I think the better option would be to pass the value that you need from pageA to pageB either using a QueryString object or a Session variable, depending on the situation. If i've misunderstood what you're trying to do, let me know

nakor77 21 Junior Poster in Training

Try adding CommandName="Insert" to the link button in the item template

nakor77 21 Junior Poster in Training

knowing the error you're getting would help a lot. As a side note, you don't need to use .ToString() on the Text property of a textbox control, it's already a string.

nakor77 21 Junior Poster in Training

Look at the CollapsiblePanel extener from the AjaxControlToolkit. You should be able to use that and place a GridView control inside of it.

nakor77 21 Junior Poster in Training

First, as @JorgM said, you really need to look into parameterized queries because right now your site would be extremely vulnerable to hackers.

Second, you should avoid using variable names that are C# keywords or resemble them. "for" is a keyword and "Type" is, well, a type. You could use something a little more descriptive such as "gender" and "shirtStyle" or just "style".

Third, string Type= Request.QueryString["Type"]; may give you an error on a request where you are not passing the type because that querystring will not exist. I would probably do something like the following:

Edit: As a word of caution, the following code is from memory, it may not compile without a little tweaking, but it should be close enough to get you going in the right direction with a little research on your part.

string gender = Request.QueryString["For"];
string style = Request.QueryString["Type"] ?? string.Empty; // sets it to an empty string if null

SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=HP-HP\\SQLEXPRESS;Initial Catalog=OnlineShop;User ID=sa;password=rane@1234";

string query = "Select * from Shirts where ForMW=@gender and (Type=@style OR @style='')";
SqlCommand cmd = new SqlCommand(query, con);
cmd.Parameters.AddWithValue("@gender", gender);
cmd.Parameters.AddWithValue("@style", style);

con.Open();
SqlDataReader dr = cmd.ExecuteReader();
dt = new DataTable();
nakor77 21 Junior Poster in Training

from your description I can't think of any specific one control that does what you're wanting. However you should be able to create something at least close to what you want using html and javascript

nakor77 21 Junior Poster in Training

You would use one of the other methods by passing it the parameter types that it expects. If you want to use the method that takes two integers, then pass it two integers. If you want to use the method that takes two doubles, then pass it two doubles. The types of the parameters will determine which of the methods gets called.

nakor77 21 Junior Poster in Training

This snippet will allow you to easily work with session variables in your applications. This example is using a string type but it works the same for any data type, you would just need to change the default return value from string.Empty to something more appropriate.

nakor77 21 Junior Poster in Training

Do you have a table named adb? You're trying to insert a Student ID, are you sure the table isn't named Students or something similar?

nakor77 21 Junior Poster in Training

where's the code for UrlHelper? Does it have a method or property named AccountPicture?

nakor77 21 Junior Poster in Training

What kind of template are you talking about? Is this for some sort of content management system or something else?

nakor77 21 Junior Poster in Training

The query string is what gets passed at the end of the url. If the page url is "http://www.mywebsite.com/index.aspx?id=123" then there is a query string with a key of "id" and a value of "123". It's useful for telling a page to load specific information. It's scope is just for that specific request.

nakor77 21 Junior Poster in Training

Where is the variable 'ds' gettings it's value from? How is 'ds' defined on the page?

nakor77 21 Junior Poster in Training

Is thre a reason you have the part where you rebind the GridView commented out?

nakor77 21 Junior Poster in Training

are you creating any of these controls dynamically or are they all defined on the .aspx page? With the MultiView all of the controls are present on the page that are defined in the view. It should just be a matter of accessing it like any other control. TextBox1.Text or DropDownList1.SelectedValue, for example.

nakor77 21 Junior Poster in Training

I'd use a FilteredTextBoxExtender from the AjaxControlToolkit.

For the YUP control, if it's always going to have YUP at the front then just limit them to putting in the numeric part of it and you can add the YUP to it.

nakor77 21 Junior Poster in Training

I'm not sure if this is where I should post a bug, so if not maybe it can be moved.

When making a post the thread count does not increase until the page is refreshed. This is in the mini profile area on the left side of the post. Not a big deal really, just doesn't seem to work quite like you'd expect it to.

nakor77 21 Junior Poster in Training

Have you defined the EditTemplate in the ListView? Providing some code would probably help so we can see what's going on. Are you getting any errors?

nakor77 21 Junior Poster in Training

I understand, just wanted to make sure. Have a look at this and see if it helps.

nakor77 21 Junior Poster in Training

Shouldn't the controls in the UpdatePanel be inside of a <ContentTemplate> tag?

nakor77 21 Junior Poster in Training

The easiest way is to use the PagerStyle-CssClass property and then just style the pager using CSS

Here's a link to a simple example.

nakor77 21 Junior Poster in Training

What are the errors you are getting? Can you provide the code for the edit event?

nakor77 21 Junior Poster in Training

You can use the template field as suggested by JorgeM. If you use the AjaxControlToolkit then you could use the FilteredTextBoxExtender to limit what the user is able to enter.

Regardless of how you handle it on the client side you should always validate the input on the server side since it is possible for users to change what is being sent to the server between the time when it's validated on the client side and when it actually gets sent.

A gridview column often is just made of BoundFields and looks similar to

<Columns>
    <asp:BoundField DataField="ColumnOne" SortField="ColumnField" />
</Columns

When using a template field that would instead look like

<Columns>
    <asp:TemplateField HeaderText="Column One" SortField="ColumnOne">
        <ItemTemplate>
            <asp:Label ID="label_ColumnOne" runat="server" Text='<%# Eval("ColumnOne") %>' />
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="textbox_ColumnOne" runat="server" Text='<%# Bind("ColumnOne") %>'></asp:TextBox>
        </EditItemTemplate>
    </asp:TemplateField>
</Columns>

The ItemTemplate is what is displayed by default. The EditItemTemplate gets displayed when you select "edit" for that row. You can add as many controls into a template field as makes sense for your need. So you can add a validator control to the textbox, or a filter control, or whatever.

Here's a link for a tutorial on Using TemplateFields In The GridView Control

nakor77 21 Junior Poster in Training

How are you loading the data for your listview? Are you going to be using a datasource control, such as a SqlDataSource or EntityDataSource? Or are you going to be setting the datasource in your code behind somewhere? Will the ListView always display the same columns? It would help some to see what code you have so far and maybe someone could point out where you're going wrong.

nakor77 21 Junior Poster in Training

If you're using .net 4.0 or later you can create default values for your parameters

public static void Feed(string Food="Unknown")
{
    if (Food != "Unknown")
    Console.WriteLine("{0} eats some {1}.", Name, Food);
}
nakor77 21 Junior Poster in Training

just move your code to close the connection to the end of the request where you open the connection.

your code should follow the basic format of

open connection
perform work in database
close connection

nakor77 21 Junior Poster in Training

The property is basically just a shortcut for a method that returns a value. If you looked at the il for it you would find that a get method was created by the compiler.
If you had a property called Age the generated il asm code would contain get_Age and set_Age methods.

public int Age {get;set;}

is converted to

.property instance int32 Age()
{
  .get instance int32 PropertiesExample.PropertiesClass::get_Age()
  .set instance void PropertiesExample.PropertiesClass::set_Age(int32)
}

So as far as execution speed goes, it would be the same between a GetString method that only returns a string and a property that only returns a string.

nakor77 21 Junior Poster in Training

You shouldn't be trying to leave a connection open like that. You should close the connection in the same request in which it was opened. Also I doubt Your static variables will work quite like you want. ASP.net is a multi threaded environment which means you could still have multiple instances of those static variables, one for each thread that might be open. In general you should avoid things like global static variables or singletons when working in ASP.Net.

varoluscu_prens commented: thank you +1
nakor77 21 Junior Poster in Training

What exactly do you need help with? Do you have any code for this yet? Are you getting any errors? I'm more than willing to help, but I'm not going to just do your work for you.