Click here to Skip to main content
16,015,641 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Javascript and Datagrid Pin
Ista27-Jul-06 4:36
Ista27-Jul-06 4:36 
Question.aspx upload Pin
kirthikirthi25-Jul-06 9:02
kirthikirthi25-Jul-06 9:02 
AnswerRe: .aspx upload Pin
Guffa25-Jul-06 11:12
Guffa25-Jul-06 11:12 
GeneralRe: .aspx upload Pin
kirthikirthi25-Jul-06 11:23
kirthikirthi25-Jul-06 11:23 
AnswerRe: .aspx upload Pin
Guffa25-Jul-06 20:38
Guffa25-Jul-06 20:38 
GeneralRe: .aspx upload Pin
Amit Agarrwal25-Jul-06 20:48
Amit Agarrwal25-Jul-06 20:48 
QuestionError Handling with customErrors tag Pin
mrinmayeek25-Jul-06 8:41
mrinmayeek25-Jul-06 8:41 
Questionadded dynamic row with textbox to gridview but missing viewstate on postback Pin
silverfox_118825-Jul-06 8:15
silverfox_118825-Jul-06 8:15 
Hi everyone,

I added a GridViewRow dynamically that has a textbox. I type something into textbox and do a postback, but the textbox is empty. I'm rebinding the gridview on Page_Load everytime, but I can not see where there issue lies. Can someone take a look at my code and see if they can catch it?

aspx file ..................................................

<%@ Page Language="C#" trace ="true" AutoEventWireup="true" CodeFile="Default9.aspx.cs" Inherits="Default9" %>





<title>Untitled Page





<asp:gridview id="GridView1" runat="server" allowsorting="True" autogeneratecolumns="False" datakeynames="categoryid" datasourceid="SqlDataSource1" onrowdatabound="onGVRowDataBound">

<columns>
<asp:boundfield datafield="categoryid" headertext="categoryid" insertvisible="False"
="" readonly="True" sortexpression="categoryid">
<asp:boundfield datafield="description" headertext="description" sortexpression="description">



<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:JimTestConnectionString %>"
="" deletecommand="DELETE FROM [Category] WHERE [categoryid] = @categoryid" insertcommand="INSERT INTO [Category] ([description]) VALUES (@description)" selectcommand="SELECT top 10 [categoryid], [description] FROM [Category]" updatecommand="UPDATE [Category] SET [description] = @description WHERE [categoryid] = @categoryid">

<deleteparameters>
<asp:parameter name="categoryid" type="Int32">


<updateparameters>
<asp:parameter name="description" type="String">
<asp:parameter name="categoryid" type="Int32">


<insertparameters>
<asp:parameter name="description" type="String">









cs file..................................

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default9 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataBind();
}

protected void onGVRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{


Table objParentTable = ((Table)e.Row.Parent);
objParentTable.ID = "Table1";

GridViewRow objTableRow = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
objTableRow.ID = "GVRow2nd";

objParentTable.Controls.Add(objTableRow);


TableCell objTableCell = new TableCell();
objTableCell.ID = "firstCell";
//jTableRow.Cells.Add(objTableCell);
objTableRow.Controls.Add(objTableCell);
TextBox objTB = new TextBox();

PlaceHolder objPH = new PlaceHolder();
objPH.Controls.Add(objTB);
objTableCell.Controls.Add(objPH);
objTableCell.ID = "firstCell2";
objTB.ID = "firsttextbox";
objPH.ID = "firstPlaceHolder";









}
}
}


Great thing comes to those who share Big Grin | :-D

AnswerRe: added dynamic row with textbox to gridview but missing viewstate on postback Pin
ToddHileHoffer25-Jul-06 9:50
ToddHileHoffer25-Jul-06 9:50 
AnswerRe: added dynamic row with textbox to gridview but missing viewstate on postback Pin
silverfox_118825-Jul-06 11:50
silverfox_118825-Jul-06 11:50 
GeneralRe: added dynamic row with textbox to gridview but missing viewstate on postback Pin
ToddHileHoffer26-Jul-06 2:19
ToddHileHoffer26-Jul-06 2:19 
GeneralRe: added dynamic row with textbox to gridview but missing viewstate on postback Pin
silverfox_118826-Jul-06 19:11
silverfox_118826-Jul-06 19:11 
GeneralRe: added dynamic row with textbox to gridview but missing viewstate on postback Pin
Ista27-Jul-06 6:55
Ista27-Jul-06 6:55 
GeneralRe: added dynamic row with textbox to gridview but missing viewstate on postback Pin
silverfox_11882-Aug-06 5:03
silverfox_11882-Aug-06 5:03 
QuestionDataBinder output Pin
TheMajorRager25-Jul-06 8:00
TheMajorRager25-Jul-06 8:00 
AnswerRe: DataBinder output Pin
ToddHileHoffer25-Jul-06 9:45
ToddHileHoffer25-Jul-06 9:45 
GeneralRe: DataBinder output Pin
TheMajorRager25-Jul-06 11:36
TheMajorRager25-Jul-06 11:36 
QuestionDifference Pin
kjosh25-Jul-06 7:28
kjosh25-Jul-06 7:28 
AnswerRe: Difference Pin
Guffa25-Jul-06 8:20
Guffa25-Jul-06 8:20 
QuestionRedircet Page Pin
kirthikirthi25-Jul-06 7:07
kirthikirthi25-Jul-06 7:07 
AnswerRe: Redircet Page Pin
enjoycrack29-Jul-06 6:44
enjoycrack29-Jul-06 6:44 
QuestionCharts and graphs using .NET Pin
TheMajorRager25-Jul-06 6:52
TheMajorRager25-Jul-06 6:52 
AnswerRe: Charts and graphs using .NET Pin
minhpc_bk25-Jul-06 20:03
minhpc_bk25-Jul-06 20:03 
Questionbuild via coding Pin
sund7wells25-Jul-06 5:20
sund7wells25-Jul-06 5:20 
AnswerRe: build via coding Pin
RichardGrimmer25-Jul-06 5:53
RichardGrimmer25-Jul-06 5:53 

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.