nakor77 21 Junior Poster in Training

Set the autogeneratecolumns property to false

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

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

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 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

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

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

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

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

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

Here's a link for using multiple membership providers:

http://stackoverflow.com/questions/5342158/using-multiple-membership-providers-within-asp-net-mvc-3-application

if you want to give that a try

nakor77 21 Junior Poster in Training

You could make use of generics.

    class MyInterfaceFactory
    {
        public static T GetClass<T>() where T : myInterface
        {
            myInterface temp = null;

            if (typeof(T) == typeof(ClassOne)) temp = new ClassOne();
            else if (typeof(T) == typeof(ClassTwo)) temp = new ClassTwo();
            else if (typeof(T) == typeof(ClassThree)) temp = new ClassThree();

            return (T)temp;
        }
    }

This is a pretty simple example, you should be able to implement it with your interface and classes fairly easily I think.

DrMAF commented: what does myInterface contain?? what is the implementation of ClassOne, for example?? +0
nakor77 21 Junior Poster in Training

I believe the default timeout for session is 20 minutes, but you can modify that in your web.config if you need to specify a different time span. Also, a note on hericles suggestion, the session_end event is available when using InProc session storage. This is the default option so unless you've specified a different type of session storage, such as state server or sql server, this is what you're using.

nakor77 21 Junior Poster in Training

Make sure you have the latest versions of jquery, jquery.validate, and modernizr if you're using them. Some of the older versions will cause telerik to break.

in the code they passe new GridModel(employees)
but this object is not catch in the view.
then how data is catch

When the action is marked with the GridAction attribute it returns the GridModel as a JSON object that is used to update the contents of the telerik grid. Since you are using Ajax databinding this is done with an Ajax call to the server.

nakor77 21 Junior Poster in Training

move the code that sets your textbox values into its own method. Call that method from the page_load event but put it inside an "If IsPostBack" so that it's only called when the page initially loads and not on each postback after that. Also call that method at the end of your update button's click event.

Basically what is happening right now is that that the page load event is being called before the button's click event executes so it is refreshing the data in the textboxes to their original values and updating the data in the database with those values rather than the data that was entered into the textboxes but the user.

If you google "msdn ASP.NET page event life cycle" you should be able to find some more in depth information on how the page event life cycle works for asp.net.

JorgeM commented: good response +6
nakor77 21 Junior Poster in Training

Ok, I'll try to walk through a quick example for you. I've created a page that has two button controls, a Panel and a label. What it's going to do is on the click of the first button there will be 5 dropdownlists added to the panel. On the second button click it will get the values from those dropdownlists and display them all in the label. The first thing I need to do is to have a way to know how many dropdownlists I have created. In order to do this I will create a property that saves that count in viewstate.

public int DDLCount
{
    get
    {
        // Try to get an instance of the DDLCount ViewState object
        object temp = ViewState["DDLCount"];
        // If temp is not null then cast it to int and return it,
        // otherwise return 0
        return temp == null ? 0 : (int)temp;
    }
    set { ViewState["DDLCount"] = value; }
}

Next I'll create a method to add the dropdownlists to the page.

private void CreateDropDownLists()
        {
            // This is just to set the count to a default value
            // You may possibly need to generate the count of dropdownlists
            // in some other manner, depending on your project
            if (DDLCount == 0)
                DDLCount = 5;

            
            for (int i = 0; i < DDLCount; i++)
            {
                // Create the dropdownlists
                DropDownList ddl = new DropDownList();
                ddl.ID = "Text_" + i;
                ddl.Items.Add(new ListItem("TestText_" + i, "TestValue_" + i));

                // Add it to the panel …
goltu commented: Good knowledge of programming +0
nakor77 21 Junior Poster in Training

where are you setting the gridview's datasource?

nakor77 21 Junior Poster in Training

If the number is always the last character and is only a single digit you could do something like this

int i = 0;

if (int.TryParse(command.Last().ToString(), out i))
{

}

If there's a chance that command might be empty then you'd want to check for that before trying to call int.TryParse on it

You could also use command.First() to get the char value of the first character in the string. You'll need to add a "using System.Linq" for these methods if you don't already have it.

ddanbe commented: Not Bad! +14
nakor77 21 Junior Poster in Training

You may need to cast the returned control as a TextBox

t = CType(me.findcontrol("textbox" & i), TextBox)

you may also want to check and make sure that t is not Nothing before trying to call its Text property. If the control is not found then t will not be set to a value and you'll get the "Object Reference not set..." error