|
If you want to group stuff together like this, you probably need to nest gridviews, or perhaps repeaters, to give you more control. Your data source should then change accordingly, so each nested control is bound to a group.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks for your response Chris,
If it is no bother, could you please post a sample code snippet? put in mind though that I can't change the datasource because it is being used in multiple places but I was thinking that the grouping could be done on databound..
|
|
|
|
|
If you can't change the data source, then you have a lot of work ahead of you. I was imaging two controls like this:
<asp:Repeater >
<ItemTemplate>
<asp:Repeater>
Then you bind a list of the top level ids to the repeater, and in onitemdatabound, look up the inner repeater and bind it to the table that corresponds to the id passed into the row. Obviously you add code to style it the way you want, define the columns, etc, the point is just that you get the granularity to create and style the data into groups.
I imagine if you're not allowed to create a new method to return a group of tables, that you'd need to write code that binds to the group names, and then searches the data source to filter based on group name.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
I have a website (web-project), which I can publish locally and then run thru the virtual directory.
But when I moved that published code to the hosting of www.godaddy.com, it doesn't work and says:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
Why it happens? No one error happens on my side, the pages are simple, moreover, the one I tried to run has the only one control with static text, under masterpage. Even when I set the cutomErrors="Off", nothing is shown for me and no additional information...
Please advise.
|
|
|
|
|
Well, what's obvious is, there is an error, and you've not succeeded in setting up your web.config in such a way that the error is reported to you.
That it's reading the web.config means that you have .NET installed ( although perhaps the wrong version ). Beyond that, you need to find out the actual error, in order to fix it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
It could be any number of things, wrong version of .net framework, a custom control, a dependent assembly is missing, a bad character in the config file. I would suggest you contact godaddy technical support.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: I would suggest you contact godaddy technical support.
ROTFL. They will say 'it's a coding error, fix it yourself'. They say that even when you present evidence that this is not the case. They are worse than useless.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Never used GoDaddy. I'm spoiled by having control over my own environments.
only two letters away from being an asset
|
|
|
|
|
We're a big company, I have been fighting for that ability for some time now.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi All,
I am trying to create Enum Dynamically.
When I try to Save dll It gives me error - "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" I am also writing code snippet :-
AppDomain currentDomain = AppDomain.CurrentDomain;
AssemblyName aName = new AssemblyName("TempAssembly");
AssemblyBuilder ab = currentDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.RunAndSave);
ModuleBuilder mb = ab.DefineDynamicModule(aName.Name, aName.Name + ".dll");
EnumBuilder eb = mb.DefineEnum("Elevation", TypeAttributes.Public, typeof(int));
eb.DefineLiteral("Low", 0);
eb.DefineLiteral("High", 1);
Type finished = eb.CreateType();
ab.Save(aName.Name + ".dll");
I got error at last line.
Please help me.
your help is appreciated.
Regards,
Sunil Dhiman
|
|
|
|
|
Is it your web application ? if yes then where the application is hosted ? Do you have the write permission on that dll ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
The code seems to be fine. It should work.
The problem definitely is the FileIOPermission. Check if ASP.NET has write permission to the folder where the dll is created.
|
|
|
|
|
Hi,
In my intranet application (VB.Net, Framework 2) when Iam trying to export data to csv format junk charaters are displayed in place of Arabic data...
When Iam tying to export the same data to Excel it is working fine...
What could be the reason why it is not displaying the junk characters....
Please guide what is going wrong...
Thanks
Imtiaz
Imtiaz A.K
|
|
|
|
|
What encoding are you using? When Unicode characters are included, you should save in Utf8 encoding.
|
|
|
|
|
 Iam using the below code..
<br />
da = New SqlDataAdapter(sQuery, Conn)<br />
da.Fill(ds)<br />
Dim GridView1 As New GridView<br />
GridView1.AllowPaging = False<br />
GridView1.DataSource = ds<br />
GridView1.DataBind()<br />
Response.Clear()<br />
Response.Buffer = True<br />
Response.AddHeader("content-disposition", "attachment;filename=Report.csv")<br />
Response.Charset = ""<br />
Response.ContentType = "application/text"<br />
Dim sb As New StringBuilder()<br />
<br />
For k As Integer = 0 To ds.Tables(0).Columns.Count - 1<br />
sb.Append(ds.Tables(0).Columns(k).ColumnName + ","c)<br />
<br />
Next<br />
sb.Append(vbCr & vbLf)<br />
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1<br />
<br />
For k As Integer = 0 To ds.Tables(0).Columns.Count - 1<br />
'add separator <br />
'sb.Append(ds.Tables(0).Rows(i)(k).ToString().Replace(",", ";") + ","c)<br />
sb.Append(ds.Tables(0).Rows(i)(k).ToString() + ",")<br />
Next<br />
'append new line <br />
sb.Append(vbCr & vbLf)<br />
Next<br />
Response.Output.Write(sb.ToString())<br />
Response.Flush()<br />
Response.End()<br />
Is there anything wrong in this code...
But when Iam trying to export the same data to Excel it is working fine....
if the issue is with unicode then it should not also support the Excel....
Please guide..
Imtiaz
Imtiaz A.K
|
|
|
|
|
Try,
Response.ContentEncoding = Encoding.UTF8;
Response.Charset = "UTF-8";
|
|
|
|
|
no change..
same issue..
any other suggestion...
Imtiaz A.K
|
|
|
|
|
Well, csv is only comma-separated values. You can open it in Text editors. If you are downloading a unicode file and open in TextMode it will not be shown properly. try to open the same file in unicode editors. I think you can see them clearly.
Excel format is actually supports Unicode. So if you open a file containing unicode characters in Excel, it will be shown properly.
As Navaneeth suggested, you can make the file download using
Response.ContentEncoding = Encoding.UTF8;
Response.Charset = "UTF-8";
which will ensure that the data downloaded is parsed as Unicode.
|
|
|
|
|
As Iam exporting dataset to csv format ....
Iam opening it in excel only... still it is giving junk characters...please check the code I had added...
this code wil directly prompt a (Open/save)dialog box and when we click open it will open the file in excel...
Even though it is opened in Excel which supports Unicode characters, it is still showing junk values in place of arabic data...
Please suggest...
Thanks..
Imtiaz A.K
|
|
|
|
|
Hello all
When I buy domain and host what should I do to use databases and is database on my hard drive or it's on the server?
|
|
|
|
|
hasani2007 wrote: When I buy domain and host what should I do to use databases and is database on my hard drive or it's on the server?
It should be on server. And how to use it for that you need to contact with the Hosting Site Admin or try to read the help file for that.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hello everyone, I always apologize for my English not perfect. Anyway I wanted to ask you how to load data in a DetailsView without using the SqlDataSource control. I want to load data using only C #, are familiar with the property "DetailsView1.DataSource = fuction ();"
but I'm not sure how it works, someone can explain it to me?
Here's the code that I wrote:
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
DetailsView1.DataSource = aggiorna();<br />
DetailsView1.DataBind(); <br />
}<br />
public DataTable aggiorna()<br />
{<br />
string IDModelloQ = Request.QueryString["IDModelloV"];<br />
SqlCommand comando = new SqlCommand();<br />
SqlConnection connessione = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);<br />
connessione.Open();<br />
comando.Connection = connessione;<br />
comando.CommandType = CommandType.Text;<br />
comando.CommandText = "SELECT * FROM Automobili WHERE IDModello=" + IDModelloQ;<br />
try<br />
{<br />
comando.ExecuteNonQuery();<br />
<br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
}<br />
finally<br />
{<br />
connessione.Close();<br />
}<br />
return What must return!?<br />
}<br />
My problem is that I don't know that since returning from the function "aggiorna ()".
|
|
|
|
|
You are clueless.
To fill a DataTable , you need to use DataAdapter and call Fill on it. Your code also got several issues including SQL injection attacks and improper resource cleanup. Here is a modified version of your code.
public DataTable aggiorna()
{
string IDModelloQ = Request.QueryString["IDModelloV"];
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
string query = "SELECT * FROM Automobili WHERE IDModello = @IDModelloQ";
DataTable table = new DataTable();
using(SqlConnection connessione = new SqlConnection(connectionString))
using(SqlCommand comando = new SqlCommand(query, connessione))
{
comando.Parameters.AddWithValue("@IDModelloQ", IDModelloQ);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = comando;
adapter.Fill(table);
}
return table;
} Don't catch exceptions if you are not doing anything with that. Also
catch (Exception ex)
{
throw ex;
} is stupid. This will clear the stack-trace. To re-throw use just throw .
|
|
|
|
|
Oh I understand ... but I can not find examples with sqladapter!
And that means "clueless"? (I can not find a translation in Italian!)
I know that this code is dangerous and attacked via SQL injection. But how can I do? Through stored procedures?
I apologize but I'm a beginner!
|
|
|
|