Click here to Skip to main content
16,004,833 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: how to add nodes to treeview dynamically Pin
prameelapydi13-Nov-06 17:11
prameelapydi13-Nov-06 17:11 
QuestionASP.NET 2.0 menu control .. How to ?? [modified] Pin
Omkar Ghaisas12-Nov-06 18:21
Omkar Ghaisas12-Nov-06 18:21 
Questionhow to edit and update datalist Pin
chinnivinay12-Nov-06 18:19
chinnivinay12-Nov-06 18:19 
AnswerRe: how to edit and update datalist Pin
Suresh Pirsquare12-Nov-06 20:01
Suresh Pirsquare12-Nov-06 20:01 
AnswerRe: to know what are methods that loaded when page is loaded Pin
George L. Jackson12-Nov-06 17:56
George L. Jackson12-Nov-06 17:56 
AnswerRe: to know what are methods that loaded when page is loaded Pin
just3ala212-Nov-06 19:25
just3ala212-Nov-06 19:25 
Questionto know what are methods that loaded when page is loaded Pin
chinnivinay12-Nov-06 16:48
chinnivinay12-Nov-06 16:48 
QuestionComplex and Interesting DataGrid Dynamic Control problem Pin
anshubansal12-Nov-06 16:08
anshubansal12-Nov-06 16:08 
Dear ALL,
I am facing a bit problem in DATAGRID. so may be you guys can help me
out.
Actually on a DataGrid I am having following controls:
1) 2 DropDown Menu
2) 1 Text Box
3) 1 ADD Button
4) 1 Remove Button

So these all controls are in 1 row and looks like:

DROPDOWN1 DROPDOWN2 TEXTBOX ADD BUTTON REMOVE BUTTON.

So when user will press ADD Button then the same new row will be
populated and will look like.

DROPDOWN1 DROPDOWN2 TEXTBOX ADD BUTTON REMOVE BUTTON (ROW1)
DROPDOWN1 DROPDOWN2 TEXTBOX ADD BUTTON REMOVE BUTTON (ROW2)

And So on. So these rows will be populated until user press ADD BUTTON.
and similarly on pressing the REMOVE BUTTON the corresponding ROW will
be deleted.

I have implemented this functionality. but NOW the REAL PROBLEM comes
into picture.

Actually, when this SECOND ROW (ROW 2 and so on) will be populated
then I have to set the VISIBILITY of ADD BUTTON of FIRST ROW (or
previous row) to FALSE.

SO LOGICALLY SPEAKING this ADD Button should be visible only for the
CURRENT ROW and for all the previous rows the ADD BUTTON's TEXT should
be replaced by a LABEL Control.

I tried to access this BUTTON CONTROL a lot but was unable to do that.

So if you have any idea then please let me know. I am posting the code
for your review. Your help is really appreciated.

public void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
dsSource.Tables.Add(new DataTable("RepeaterSource"));
dsSource.Tables[0].Columns.Add(new DataColumn("DropDownValue2"));
dsSource.Tables[0].Columns.Add(new DataColumn("EditBoxValue"));
dsSource.Tables[0].Rows.Add(new Object[] { 2,""});
datagrid1.DataSource = dsSource;
datagrid1.DataMember = "RepeaterSource";
datagrid1.DataBind();

Session[DATA_SOURCE_KEY] = dsSource;
}
else
{
dsSource = (DataSet)Session[DATA_SOURCE_KEY];
datagrid1.DataSource = dsSource;
datagrid1.DataMember = "RepeaterSource";
}

}

public void OnItemCommand(Object sender, DataGridCommandEventArgs e)
{
if(e.CommandName == "Add")
dsSource.Tables[0].Rows.Add(new object[] {1,"Text Here" });
datagrid1.DataBind();
Session[DATA_SOURCE_KEY] = dsSource;
}

if(e.CommandName =="Delete")
{
dsSource.Tables[0].Rows[e.Item.ItemIndex].Delete();
datagrid1.DataBind();
Session[DATA_SOURCE_KEY] = dsSource;
}

}

HERE IS THE CODE BEHIND PAGE:`
<asp:datagrid id="datagrid1" runat="server" width="288px"
gridlines="Vertical" font-size="8pt"
font-name="verdana" cellpadding="3" autogeneratecolumns="False"
showfooter="True" borderwidth="1px" bordercolor="#999999"
backcolor="White" font-names="verdana" borderstyle="None"
onitemcommand="OnItemCommand"
<columns="">
<asp:templatecolumn>
<itemtemplate>
` <asp:dropdownlist runat="server"
id="comparatorDropDown">
<asp:listitem value="2" text="Select Comparator"
lected="True">



<asp:templatecolumn>
<itemtemplate>
<asp:dropdownlist id="Dropdownlist1"
runat="server">
<asp:listitem
value="citigroup_cfo">CitiGroup_Cfo
<asp:listitem
value="citigroup_cf1">CitiGroup_Cf1



<asp:templatecolumn>
<itemtemplate>
<asp:textbox id="Textbox1" runat="server"
columns="20">


<asp:templatecolumn>
<itemtemplate>
<asp:label runat="server" id="Label1"
visible="true">AND
<footertemplate>
<asp:button text="Add Condition" font-size="10px"
runat="server"
id="AddButton" commandname="Add" width="100%">


<asp:templatecolumn>
<itemtemplate>
<asp:button runat="Server" text="Remove
Condition"
id="RemoveButton" commandname="Delete" width="100%" font-size="10px">




QuestionSkins and CSS in ASP.NET 2.0. I am completely confused! Pin
shapper12-Nov-06 14:07
shapper12-Nov-06 14:07 
Questionasp.net application configuration - setting up roles and membership Pin
Guy Harwood12-Nov-06 11:24
Guy Harwood12-Nov-06 11:24 
AnswerRe: asp.net application configuration - setting up roles and membership Pin
Guy Harwood14-Nov-06 1:37
Guy Harwood14-Nov-06 1:37 
QuestionC# and ASP.NET Pin
mough12-Nov-06 4:39
mough12-Nov-06 4:39 
Questioncheck Box List and SelectedValue prob.? [modified] Pin
Naif_Prof12-Nov-06 3:59
Naif_Prof12-Nov-06 3:59 
QuestionEvent problem Pin
shapper12-Nov-06 3:56
shapper12-Nov-06 3:56 
AnswerRe: Event problem Pin
CWIZO12-Nov-06 11:17
CWIZO12-Nov-06 11:17 
GeneralRe: Event problem Pin
shapper12-Nov-06 12:17
shapper12-Nov-06 12:17 
Question&lt;form> on masterpage and user controls Pin
moazzamahmed11-Nov-06 20:35
moazzamahmed11-Nov-06 20:35 
AnswerRe: &lt;form> on masterpage and user controls Pin
Guffa12-Nov-06 0:33
Guffa12-Nov-06 0:33 
GeneralRe: &lt;form> on masterpage and user controls Pin
moazzamahmed13-Nov-06 11:52
moazzamahmed13-Nov-06 11:52 
QuestionInserting line numbers Pin
sudidela11-Nov-06 19:02
sudidela11-Nov-06 19:02 
QuestionGenerics & ViewState Pin
eggie511-Nov-06 17:41
eggie511-Nov-06 17:41 
AnswerRe: Generics & ViewState Pin
aamironline12-Nov-06 1:58
aamironline12-Nov-06 1:58 
Questionwhat is the opposite action for Fill(dataset) Pin
karanba11-Nov-06 14:48
karanba11-Nov-06 14:48 
AnswerRe: what is the opposite action for Fill(dataset) Pin
Guy Harwood12-Nov-06 11:18
Guy Harwood12-Nov-06 11:18 
Questionclosing a connection Pin
karanba11-Nov-06 14:01
karanba11-Nov-06 14:01 

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.