Click here to Skip to main content
15,917,601 members
Home / Discussions / C#
   

C#

 
QuestionLEXICAL ANALYSIS Pin
waheed awan18-Nov-07 8:37
waheed awan18-Nov-07 8:37 
AnswerRe: LEXICAL ANALYSIS Pin
DavidNohejl18-Nov-07 11:38
DavidNohejl18-Nov-07 11:38 
Questionhow to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi18-Nov-07 8:18
ShaikhAffi18-Nov-07 8:18 
AnswerRe: how to add row with checkboxes inside in table server control using c# Pin
SABhatti18-Nov-07 13:00
SABhatti18-Nov-07 13:00 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi18-Nov-07 22:31
ShaikhAffi18-Nov-07 22:31 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
SABhatti19-Nov-07 14:08
SABhatti19-Nov-07 14:08 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi19-Nov-07 22:27
ShaikhAffi19-Nov-07 22:27 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
SABhatti20-Nov-07 6:26
SABhatti20-Nov-07 6:26 
here is the sample page for exactly what you want:

aspx page (I have added only one template column with text box, but you can add as many as you want):

<asp:GridView ID="gv" runat="server" OnRowDataBound="gvRowDataBound">
<Columns>
<asp:TemplateField HeaderText="test">
<ItemTemplate>
<asp:TextBox ID="tb" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="btn" runat="server" Text="Add" OnClientClick="javascript:document.getElementById('hf').value='true';return true;" />
<asp:HiddenField ID="hf" runat="server" />

code behind file:

protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
if (Request.Form["hf"] == "true")
addGVRow();
hf.Value = string.Empty;
}

private void addGVRow()
{
DataTable dt = (DataTable)Session["dt"];
int counter = 0;
if (dt == null)
{
dt = new DataTable();
dt.Columns.Add("seq");
}
else
counter = dt.Rows.Count;
DataRow dr = dt.NewRow();
dr[0] = counter + 1;
dt.Rows.Add(dr);
gv.DataSource = dt;
gv.DataBind();
Session["dt"] = dt;
}

protected void gvRowDataBound(object sender, GridViewRowEventArgs e)
{
// hide the last cell (sequence)
e.Row.Cells[e.Row.Cells.Count - 1].Visible = false;
}

I am assuming that first time the page will be blank with add button only.


-----
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi20-Nov-07 22:52
ShaikhAffi20-Nov-07 22:52 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
SABhatti21-Nov-07 0:45
SABhatti21-Nov-07 0:45 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi21-Nov-07 10:55
ShaikhAffi21-Nov-07 10:55 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
SABhatti22-Nov-07 4:37
SABhatti22-Nov-07 4:37 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi23-Nov-07 8:54
ShaikhAffi23-Nov-07 8:54 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi23-Nov-07 9:05
ShaikhAffi23-Nov-07 9:05 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
SABhatti23-Nov-07 11:41
SABhatti23-Nov-07 11:41 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi23-Nov-07 12:12
ShaikhAffi23-Nov-07 12:12 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi24-Nov-07 6:20
ShaikhAffi24-Nov-07 6:20 
AnswerRe: how to add row with checkboxes inside in table server control using c# Pin
SABhatti24-Nov-07 11:25
SABhatti24-Nov-07 11:25 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi24-Nov-07 22:20
ShaikhAffi24-Nov-07 22:20 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi24-Nov-07 22:28
ShaikhAffi24-Nov-07 22:28 
GeneralRe: how to add row with checkboxes inside in table server control using c# Pin
ShaikhAffi28-Nov-07 9:52
ShaikhAffi28-Nov-07 9:52 
Questionfind the value member in listbox Pin
Mohammed Elkholy18-Nov-07 6:50
Mohammed Elkholy18-Nov-07 6:50 
AnswerRe: find the value member in listbox Pin
pmarfleet18-Nov-07 7:48
pmarfleet18-Nov-07 7:48 
QuestionGeneral question Class Library project Pin
Khoramdin18-Nov-07 6:01
Khoramdin18-Nov-07 6:01 
AnswerRe: General question Class Library project Pin
Colin Angus Mackay18-Nov-07 8:10
Colin Angus Mackay18-Nov-07 8:10 

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.