Click here to Skip to main content
15,887,283 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questiontrying to submit an httpwebrequest with hidden field and submit button data Pin
Member 391904911-Jun-10 10:25
Member 391904911-Jun-10 10:25 
QuestionRestrict logged in user to login again Pin
Hemant Thaker11-Jun-10 7:58
Hemant Thaker11-Jun-10 7:58 
AnswerRe: Restrict logged in user to login again Pin
Adam R Harris11-Jun-10 8:10
Adam R Harris11-Jun-10 8:10 
QuestionRe: Restrict logged in user to login again Pin
Hemant Thaker11-Jun-10 8:24
Hemant Thaker11-Jun-10 8:24 
AnswerRe: Restrict logged in user to login again Pin
Adam R Harris11-Jun-10 8:43
Adam R Harris11-Jun-10 8:43 
QuestionRe: Restrict logged in user to login again Pin
Hemant Thaker11-Jun-10 8:55
Hemant Thaker11-Jun-10 8:55 
AnswerRe: Restrict logged in user to login again Pin
Adam R Harris11-Jun-10 9:11
Adam R Harris11-Jun-10 9:11 
QuestionDinamically created gridview not handling SelectedIndexChanged Pin
Zasumo11-Jun-10 7:27
Zasumo11-Jun-10 7:27 
Hi,

I've come across some articles that may have the solution to my problem, but I'm having a hard time implemeting the solutions, so I hope that anyone can help me out here...

The problem is, I have a page with a TabContainer (AjaxControlToolkit), I add each tab Dinamically on Page_Init (without checking either for PostBack or !PostBack), in each tab I also add a GridView.

So far so good, the GridView show the correct data, the problem is on SelectedIndexChanged, that never fires, I also have a RowDataBound event that fires on the creation of the gridView, but the SelectedIndexChanged doesn't, when the user changes the selection it goes straight to Page_Init.

I have the following code:

void Page_Init()
{
  (...)
  GridView gView = createGridView("gView_" + year.ToString());
  tab.Controls.Add(gView);
  (...)
}

private GridView createGridView(string ID)
{
    GridView gv = new GridView();
    gv.ID = ID;

    CommandField cField = new CommandField();
    cField.ButtonType = ButtonType.Link;
    cField.ShowSelectButton = true;
    cField.Visible = false;

    gv.Columns.Add(cField);

    gv.RowDataBound += new GridViewRowEventHandler(gv_RowDataBound);
    gv.SelectedIndexChanged += new EventHandler(gv_SelectedIndexChanged);

    return gv;
}

void gv_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
    ViewState["index"] = e.NewSelectedIndex;
}


I was hoping to save the selectedIndex on ViewState, so I could 'catch' it after the Page PostBack in order to select the correct row (because the selected index is lost after the postback).

Hope I'm not asking a dumb question Poke tongue | ;-P

Thanks in advance
AnswerRe: Dinamically created gridview not handling SelectedIndexChanged Pin
Adam R Harris11-Jun-10 8:15
Adam R Harris11-Jun-10 8:15 
GeneralRe: Dinamically created gridview not handling SelectedIndexChanged Pin
Zasumo14-Jun-10 3:01
Zasumo14-Jun-10 3:01 
GeneralRe: Dinamically created gridview not handling SelectedIndexChanged Pin
Adam R Harris14-Jun-10 3:14
Adam R Harris14-Jun-10 3:14 
GeneralRe: Dinamically created gridview not handling SelectedIndexChanged Pin
Zasumo14-Jun-10 3:58
Zasumo14-Jun-10 3:58 
GeneralRe: Dinamically created gridview not handling SelectedIndexChanged Pin
Adam R Harris15-Jun-10 9:06
Adam R Harris15-Jun-10 9:06 
QuestionUsing Resource file in C# .NET Pin
VOITDOTNET11-Jun-10 7:10
VOITDOTNET11-Jun-10 7:10 
AnswerRe: Using Resource file in C# .NET Pin
Adam R Harris11-Jun-10 8:17
Adam R Harris11-Jun-10 8:17 
GeneralRe: Using Resource file in C# .NET Pin
VOITDOTNET11-Jun-10 9:53
VOITDOTNET11-Jun-10 9:53 
AnswerRe: Using Resource file in C# .NET Pin
Sandeep Mewara11-Jun-10 10:28
mveSandeep Mewara11-Jun-10 10:28 
QuestionSearch and Replace String Value Pin
AsianRogueOne11-Jun-10 4:01
AsianRogueOne11-Jun-10 4:01 
AnswerRe: Search and Replace String Value Pin
Rhys Jacob11-Jun-10 4:51
Rhys Jacob11-Jun-10 4:51 
GeneralRe: Search and Replace String Value Pin
AsianRogueOne11-Jun-10 5:04
AsianRogueOne11-Jun-10 5:04 
GeneralRe: Search and Replace String Value Pin
AsianRogueOne11-Jun-10 5:08
AsianRogueOne11-Jun-10 5:08 
GeneralRe: Search and Replace String Value Pin
Rhys Jacob11-Jun-10 5:21
Rhys Jacob11-Jun-10 5:21 
GeneralRe: Search and Replace String Value Pin
AsianRogueOne11-Jun-10 5:34
AsianRogueOne11-Jun-10 5:34 
GeneralRe: Search and Replace String Value Pin
Rhys Jacob11-Jun-10 5:56
Rhys Jacob11-Jun-10 5:56 
GeneralRe: Search and Replace String Value Pin
AsianRogueOne11-Jun-10 6:27
AsianRogueOne11-Jun-10 6:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.