|
Do you set the value for the TreeNodes when you load data into the nodes? Also do they have different values or the same value?
|
|
|
|
|
They might have the same value, but a different ValuePath. That is, some top level nodes have children with the same values as other top level nodes. The path to each node, however, is always unique.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I'm running c# in the v1.1 framework and I'm trying to use an onClick event in an imagebutton (I named it "btnLogin") control on my Index.aspx page. The problem however is I keep getting the following error:
--------------------------------------------------------------------
Compilation Error: Method 'Index.btnLogin_Click(object, System.EventArgs)' does not match delegate 'void System.Web.UI.ImageClickEventHandler(object, System.Web.UI.ImageClickEventArgs)'
-------------------------------------------------------------------
I originally created this control in the 2.0 framework and had no problem with it. Now, however I needed to downgrade to version 1.1 and I've been experiencing this problem.
Here's my imagebutton control on my aspx page:
------------------------------------------------------------------
<asp:ImageButton ID="btnLogin" runat="server" ImageUrl="images/button_login.jpg" OnClick="btnLogin_Click" />
--------------------------------------------------------------------
...and here's my method in my code:
--------------------------------------------------------------------
public void btnLogin_Click(object s, System.EventArgs e)
{
}
--------------------------------------------------------------------
If it helps, here's how I created my btnLogin control in my code:
-------------------------------------------------------------------
protected System.Web.UI.WebControls.ImageButton btnLogin;
--------------------------------------------------------------------
...and last but not least, here's my aspx page header:
--------------------------------------------------------------------
<%@ Page Language="c#" AutoEventWireup="false" Inherits="Index" CodeBehind="Index.aspx.cs" %>
------------------------------------------------------------------
Any ideas as to what I'm doing wrong?
Thanks.
-Goalie35
|
|
|
|
|
I have never experienced this specific error, but I have had issues with conversion from 1.1 to 2.0. I realize you are doing the opposite. There are different events for the differet controls from one framework to another. I would go back to the "auto generated code" and check to see if my actual events exist under the framework.
I hope this helps you.
Regards
|
|
|
|
|
Hello,
I'm trying to add a gridview control to composite web control that i have created.
is there any specific way to add this control on the render writer?
thanks,
Lior
|
|
|
|
|
You might want to check out Dino's article[^].
|
|
|
|
|
Please read before answering:
Using Javascript I dynamically create file inputs in a table (<input type="file" id="fileInput">). When the user is finished (including deleting files if they change their mind) I have a submit button. The form that wraps all of the objects is set to run at server with the enctype of multipart/form-data.
My problem is when the form posts, I can't get the data. The HttpFileCollection of the HttpRequest is empty. And I know of no way to access the files. I know the files are being uploaded because the content length is correct. Traversing the HttpRequest object from break point yeilds no clues either.
How can I access uploaded files? My objective is to select any number of files to upload without doing a post back and when the user has finished selecting all files do the post back at the end.
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage
|
|
|
|
|
The content length is not correct.
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage
|
|
|
|
|
I am new to this. Can we use AJAX in .NET 1.1 ? I read in ajax web site that they provide ajax_xxxx.dll to develope app.
Any thoughts ?
-- modified at 13:43 Thursday 12th October, 2006
|
|
|
|
|
AJAX doesn't requirre .NET at all. do you mean ATLAS ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
BTW, I moved this to the ASP.NET forum prior to you being flamed to a crisp on the lounge. No programming questions are allowed in the lounge
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Sir,
I am developing a intranet application.Around fifty five computers are accessing the server and database(SQL Server 2000) which is also in the server.
Now the problem is I want to lock the record when the particular record is being updated.I want to implement this thing.
Please help.
Thanks
|
|
|
|
|
Check this[^] boy, and so much more clikety[^], IMHO you should take Mike's advice, learn it and do it as I believe that googling for your questions takes less time than posting and waiting for help.
|
|
|
|
|
Sir,
What is view state and What's the viewstate of textbox.
Please explain.
thanks.
|
|
|
|
|
|
Sir,
What 's the difference between one , two and three tier architecture.
Thanks
|
|
|
|
|
This is a great question for Google.
I plugged in your question and got this link as an answer:
http://www.developerfusion.co.uk/show/3058/2/[^]
Here's how to do it:
1) - use your web browser to point to http://www.google.com[^]
2) - in the text box on the Google page, enter your question or something you'd like to search for
3) - click the button labeled "Google Search".
After that, you'll get a new page with a list of links that Google thinks matches your question or search terms. Click on some of the links to see the results. There are also paging links at the bottom, so you can get more results if you want.
|
|
|
|
|
Hi Guys
I am facing problem while connecting asp.net 2.0 program to sqlserver 2000 database. database is on remote machine. error is..
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
It is working perfectly in local system
Regards
Shanti Bhushan
|
|
|
|
|
|
Dear Stephan Pilz ,
My name is senthil , from INDIA.
I download your project of multilingual web site from "Codeproject" portal, your example is very nice.
Now My question is "I want to type the data in particular language itself " and i want to save the same in to sql-server 2000"
(I want to discuss more in this i you like)
I wating for your reply.
Thanks
Wtih regards
Senthil
|
|
|
|
|
hello, everyone:
I am creating a DataGrid form a DataSet with autogeneratecolumns:
dg.DataSource = ds;
dg.DataBind();
But I want to change the style of the columns. Particularly speaking, i want to have all the columns have fixed width/height so that the datagrid may look better. It is because some of the content may have many words. I have tried many methods,however, the datagrid never changed.
Any ideas?
ThanX in advance!
|
|
|
|
|
Yea, this can be tricky when auto-generating the columns, because you don't have direct access to the columns. Here's a hack you can try - it involves trapping the PreRender event for the datagrid (this assumes the data is bound prior to PreRender) and manually inspecting the grid's child control Table. Below is an example of what I mean.
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">
void Page_Load(object o, EventArgs e)
{
if (!IsPostBack)
{
myList.DataSource = CreateDataSource();
myList.DataBind();
myList2.DataSource = CreateDataSource();
myList2.DataBind();
}
}
private DataTable CreateDataSource()
{
DataTable t = new DataTable();
DataColumn c = new DataColumn();
c.DataType = System.Type.GetType("System.Int32");
c.ColumnName = "ID";
c.Unique = true;
t.Columns.Add(c);
c = new DataColumn();
c.DataType = System.Type.GetType("System.String");
c.ColumnName = "Name";
t.Columns.Add(c);
c = new DataColumn();
c.DataType = System.Type.GetType("System.String");
c.ColumnName = "City";
t.Columns.Add(c);
DataColumn[] primaryKey = new DataColumn[1];
primaryKey[0] = t.Columns["ID"];
t.PrimaryKey = primaryKey;
DataRow r = t.NewRow();
r["id"] = 1001; r["Name"] = "Jack Bauer"; r["City"] = "Los Angeles";
t.Rows.Add(r);
r = t.NewRow();
r["id"] = 1002; r["Name"] = "David Palmer"; r["City"] = "Washington D.C.";
t.Rows.Add(r);
r = t.NewRow();
r["id"] = 1003; r["Name"] = "Nina Meyers";
r["City"] = "Los Angeles"; t.Rows.Add(r);
r = t.NewRow();
r["id"] = 1004; r["Name"] = "Bill Buchanan";
r["City"] = "Los Angeles"; t.Rows.Add(r);
return t;
}
private void DG_PreRender(object o, EventArgs e)
{
DataGrid dg = (o as DataGrid);
if (dg != null)
{
Table t = (dg.Controls[0] as Table);
if (t != null)
{
if (t.Rows.Count > 0)
{
foreach(TableCell tc in t.Rows[0].Cells)
{
tc.Width=new Unit("200px");
}
}
}
}
}
</script>
<html>
<head>
<title>Fixing Columns in a AutoGenerateColumns DataGrid</title>
<style> body {font-family: 'Tahoma'; font-size: 10pt;}
td {font-size: 10pt;}
</style>
</head>
<body>
<form runat="server">
<h3>Fixing Columns in a AutoGenerateColumns DataGrid</h3>
<p>DataGrid without "fixing"</p>
<asp:DataGrid id="myList" runat="server"
AutoGenerateColumns="true"
/>
<br /><br />
<p>DataGrid with "fixing"</p>
<asp:DataGrid id="myList2" runat="server"
AutoGenerateColumns="true"
O n P r e R e n d e r="DG_PreRender"
/>
<%----%>
</form>
</body>
</html>
|
|
|
|
|
Hello ,
I tried using your code but the page displayed following error on line 66..
Server Error in '/CodeProject' Application.
Specified argument was out of the range of valid values. Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index
Source Error:
Line 64: if (dg != null)
Line 65: {
Line 66: Table t = (dg.Controls[0] as Table);
Line 67: if (t != null)
Line 68: {
..pls can u figure out what the problem is
Thanks,
Mini
|
|
|
|
|
Hi Mini. The code worked as is for me... did you change the datasource or when the data is bound?
The one thing about the technique I demonstrated is that the data must be bound to the grid before the PreRender (or other event of choice) is triggered. If the data isn't bound, then there isn't a child Table control to inspect, and I'm guessing that's why you're getting an error referencing dg.Controls[0] .
Another way to go about this, that is probably better anyway, is to use the ItemDataBound event of the DataGrid. Take a look at the event documentation for it on MSDN and you'll see an example of how it is used. It's very similar to the approach I showed here, except that you'll access a table row and its cells through the event args that are passed to the ItemDataBound event handler, rather than accessing the child Table control directly.
If there's interest, I might be able to work up an article on this fairly quickly.
|
|
|
|
|
Thank u, Mike and miniThomas, for the attention.
I have tried both of the approach, however, the datagrid is still not changed. I am wondering if it is beacause the width of the datagrid could not be longer than certain value, for some of the columns are really quite long. looking forward to ur further answer.
Regards,
Steven
|
|
|
|