|
|
I am working on VS 2005
I have an Asp.net web page designed using CSharp.
I have an html table in it with 1 row and 3 cells in that row.
I want to add new rows to it at runtime.
And I cant refer to this table through code.
Like the table's id is "htmlTbl1".
I am not able set any of its properties through .net code. Although i am able to access the properties through the html source of the webpage.
Please help.
Regards
|
|
|
|
|
set the table as <table id="tblName" runat="server">
Now you will be able to access in code behind
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
But take care of the table size lest you blow you ViewState page size.
|
|
|
|
|
Ya its a small table..Just adding up little rows to it..
Regards
|
|
|
|
|
oh ya!!
the runat tag...thanks tonnes!!!
Regards
|
|
|
|
|
But why can't i access the table if it's put as a client side control???
Regards
|
|
|
|
|
hey this is the basic functionality of server and client side controls
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
Ya true, but why can't it be accessed in the code behind when its a client side control?
-- modified at 5:35 Tuesday 30th January, 2007
Regards
|
|
|
|
|
hey code behind is server side coding
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
oh ok..then thats why it doesn't work..hmmmm..thanks a lot sylvester! i needed a bit of my basics cleared..hehe..thanks again!
Regards
|
|
|
|
|
I am working with a combo box whose contents are taken from DB to populate the db. I have given in the load event to fill the combon box when page is not postbacked.
But still each time the page postbacks the combobox is getting filled and so when i select a item in combo box and postback is done i always getting the first value in the combo box.
i have set the enableviewstate of combo box as true
Can any one tell me how to hold value in the combobox
Regards
Thanks in advance
hari
|
|
|
|
|
Do the databinding only the first time when page loads.
If Not Page.IsPostBack Then
DataBindings
End IF
|
|
|
|
|
i have done like that only.
but still its not working. Its working in locally. But fails when uploaded to server. is there anything to set in the server for this?
|
|
|
|
|
can you paste the code snippet here?
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
Hi,
I am having web application .In that I need to use user defined right click menu.
Is any one having idea about it? Please help me.
kamalnath
|
|
|
|
|
hi
see the below link, you will get some idea
http://www.codeproject.com/aspnet/DHTMLMenuASPNET.asp
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
You can add oncontextmenu event handler for your DOM element or add onmouseup event handle where one can check which button is moused up - by event property button:
<br />
var ev = (e ? e : window.event);<br />
var isRight = (ev.button == 2);<br />
|
|
|
|
|
|
I want to drag and drop child nodes in a treeview in asp.net with c#.
Can anyone help me out .
Thanks in advance.
|
|
|
|
|
I love that stuff... but it is little bit hard to do... because maintain states coordinates ids...
leave that .. go ot obout.com and get a free tree control from there.... it is fantastic...
|
|
|
|
|
Respected Gurus
i want to make one of my datagrid's column(ID) invisible and still wants to retrieve its(Id Column's) value to update database.
How to do that...
Because when i m making Id column invisible or even readonly,then i cannot retrieve the value of that column or any other column.
Hope understand my problem
Plz help.....
|
|
|
|
|
<form id="Form1" method="post" runat="server">
<asp:textbox id="TextBox1" style="Z-INDEX: 101; LEFT: 264px; POSITION: absolute; TOP: 104px"
runat="server"></asp:textbox><asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Id" Visible="False"></asp:BoundColumn>
</Columns>
</asp:datagrid>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 160px; POSITION: absolute; TOP: 224px" runat="server"
Text="Button"></asp:Button></form>
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Name"));
dt.Columns.Add(new DataColumn("Id"));
DataRow dr = dt.NewRow();
dr["Name"] = "Abccbdfejkerhjerjje";
dr["Id"] = "324";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Name"] = "Abc cbd fejkerhj erj je";
dr["Id"] = "325";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Name"] = "Abc cbd fejkerhj erj je";
dr["Id"] = "326";
dt.Rows.Add(dr);
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
string ids = string.Empty;
for(int i=0;i<DataGrid1.Items.Count;i++)
ids += DataGrid1.Items[i].Cells[1].Text + ",";
Response.Write(ids);
}
}
just check it in button click, I am taking all the ids
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
thanx i m getting IDs
but not on my Update command event.
my event is....
Private Sub Dtgrd_Products_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles Dtgrd_Products.UpdateCommand
Dim txtId As TextBox = CType(e.Item.Cells(2).Controls(0), TextBox)
'Dim txtid As String = e.Item.Cells(2).Text
Dim txttype As TextBox = CType(e.Item.Cells(4).Controls(0), TextBox)
Dim txtdia As TextBox = CType(e.Item.Cells(5).Controls(0), TextBox)
Dim txtlength As TextBox = CType(e.Item.Cells(6).Controls(0), TextBox)
Dim txtLamType As TextBox = CType(e.Item.Cells(7).Controls(0), TextBox)
Dim txtVarType As TextBox = CType(e.Item.Cells(8).Controls(0), TextBox)
Dim txtcol1 As TextBox = CType(e.Item.Cells(9).Controls(0), TextBox)
Dim txtcol2 As TextBox = CType(e.Item.Cells(10).Controls(0), TextBox)
Dim txtcol3 As TextBox = CType(e.Item.Cells(11).Controls(0), TextBox)
Dim txtcol4 As TextBox = CType(e.Item.Cells(12).Controls(0), TextBox)
Dim txtcol5 As TextBox = CType(e.Item.Cells(13).Controls(0), TextBox)
Dim txtcol6 As TextBox = CType(e.Item.Cells(14).Controls(0), TextBox)
conn = New SqlConnection(constr)
cmd = New SqlCommand("spr_UpdateProductDetails", conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@Id", txtId.Text))
cmd.Parameters.Add(New SqlParameter("@type", txttype.Text))
cmd.Parameters.Add(New SqlParameter("@dia", txtdia.Text))
cmd.Parameters.Add(New SqlParameter("@length", txtlength.Text))
cmd.Parameters.Add(New SqlParameter("@laminate_type", txtLamType.Text))
cmd.Parameters.Add(New SqlParameter("@varnish_type", txtVarType.Text))
cmd.Parameters.Add(New SqlParameter("@col1", txtcol1.Text))
cmd.Parameters.Add(New SqlParameter("@col2", txtcol2.Text))
cmd.Parameters.Add(New SqlParameter("@col3", txtcol3.Text))
cmd.Parameters.Add(New SqlParameter("@col4", txtcol4.Text))
cmd.Parameters.Add(New SqlParameter("@col5", txtcol5.Text))
cmd.Parameters.Add(New SqlParameter("@col6", txtcol6.Text))
conn.Open()
cmd.ExecuteNonQuery()
Dtgrd_Products.EditItemIndex = -1
conn.Close()
bindgrid()
End Sub
here in every textboxes i m getting null.
any suggetion..
|
|
|
|
|
I have a file js, in file I want exit and don't execute all code after command exit.
My program contain code java script and window script host.
expect your have of you
thank you.
Regards.
|
|
|
|