|
You can add whatever controls you'd like to the datagrid by handling the proper events, like ItemCreated, and inserting them into the row.
only two letters away from being an asset
|
|
|
|
|
I've added a checkbox column to the gridview but at run time there are no checkboxes shown because the datafield property is empty. I do not want to use that property for the checkbox column but I want the checkboxes to display.
modified on Thursday, July 16, 2009 7:20 AM
|
|
|
|
|
I must be missing something. The data field is empty but you still want to bind the column? Is the datagrid set to auto create the columns?
The data column should not be empty, a checkbox is boolean (discounting tri-state checkboxes), so set the data column values to false.
only two letters away from being an asset
|
|
|
|
|
Why do you want only GridView. Gridview will be rendered only when DataField contains something. So I dont like this.
Why dont you use Repeater to render your html?? U can place any control you want and even if it has DBNull, you can change the style of rendering the control easily.
|
|
|
|
|
Abhishek Sur wrote: U can place any control you want and even if it has DBNull
And you can't do this with a grid
only two letters away from being an asset
|
|
|
|
|
I'm reading excel file data using sql bulk copy and uploading the same inside sql server database:
My current code is:
public bool ImportMethod()
{
string sqlConnectionString = "Data Source=192.1.1.10;Initial Catalog=GePReleaseStatus;user=sa;password=sa;Integrated Security=True";
//Create Connection to Excel WorkBook
using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
{
connection.Open();
OleDbCommand command = new OleDbCommand("SELECT SrNo AS SrNo,Module AS vcrModule,DefectNoClientName AS intDefectNo, FeratureID AS intFeratureID,Priority AS vcrPriority,Description AS vcrDescription FROM [eContract_4.0.13$]", connection);
using (System.Data.Common.DbDataReader dr = command.ExecuteReader())
{
// Bulk Copy to SQL Server
using (System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(sqlConnectionString))
{
bulkCopy.DestinationTableName = "ExcelData";
bulkCopy.WriteToServer(dr);
return true;
}
}
connection.Close();
}
}
Now the problem is:-
1) I'm unable to read the excel, as it has formatted cells at top ?
(common error: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).)
2) how to read the excel from any particular row ?
3) Is it possible to read multiple sheets from a single excel file, how ?
Thanks
raj
|
|
|
|
|
1. If there is simple formatting, you can read it clearly. Otherwise you need InteropServices or other to read anything from anywhere.
2 Indeed you can read from any particular row. Just use
SELECT * FROM [w1$A10:B10]"; where w1 is the sheetname of the excel workbook.
3. Hey, you are calling select statement from your worksheet. So that implies you can ready any worksheet from your workbook, just call the worksheet name properly.
You can have a look at my article
Working with MS Excel(xls / xlsx) Using MDAC and Oledb[^]
It might help you.
|
|
|
|
|
thanks man
raj
|
|
|
|
|
Hello.
I'm just beginning with ASP.NET. I'm developing an application that uses the TcpListener. I've put all network related functions on a separated .cs file, trying to have everything a bit ordered. I use BeginRead method and I need to make the Default page know that some data has arrived in order to process it.
How can I pass a message, generate an event or call a function of the Default page? What's the more proper solution?
I've been reading some tutorials about events and delegates but I'm not able to see how they can work in two separated files...
Thanks in advance.
|
|
|
|
|
You can pass parameters to any page in the URL, something like this Http://myserver/myapp/mypage&ID=123
Where ID is a parameter that will be used by your page.
You retrieve the value of ID by using the following code:
myID = Request.QueryString("ID")
Based on the value of ID, your Page_Load event of your page can make whatever actions are necessary.
Try that.
|
|
|
|
|
Thanks for answering
Does this cause the page to reload? I need something really fast: It's for realtime video.
|
|
|
|
|
Yes. It causes the page to reload. Sounds like you have a more complicated situation.
You might want to give a more detailed explaination of what you are trying to accomplish and the folks here can point you in the right direction.
There may even be a solution aleady developed here or at CodePlex http://www.codeplex.com/[^]
The people here are very helpful.
Good luck with your project.
|
|
|
|
|
what I'm trying to do is to make a Windows Forms Application that grabs images from some cameras. It processes the images and stores results, keeps statistics and so forth. Then I want to develop a Web Application that communicates with the other, displaying real time images grabbed, and being able to configure different parameters like pan, tilt, zoom, processing thresholds, etc.
I'm just beginning with C# and ASP.NET and I feel a bit lost...
By now I'm able to transfer images from the WF application and displaying them on the ASP.NET one. But I need to use buttons. By now I'm trying to implement some sort of messaging or callback functions to display the image on the ASP.NET app each time a new grabbed image is received.
Hope this helps a bit more.
And I've seen it in these first days here, people is pretty much helpful...
|
|
|
|
|
Ah ...
Hmm. Sounds like you want to have the web page automatically update based on an event (like a new image).
This is a bit out of my realm. I could only offer the idea that you create a javascript timer that calls out to grab any new data that might be available. This is not the most elegant way to do things, but it would work.
Clearly, the more advanced guys here could offer you a better solution.
|
|
|
|
|
Yes.. Just make an AJAX request for latest updates continuously using SetInterval of Javascript. Let after every 30 seconds your page sends a server request to an HTTP handler placed in the server. This handler will give you appropriate response when new images are refreshed or return nothing...
By this way you can update your client site properly with latest updates.
But mind that, making too much calls to the server means lots of server bandwidth might be considered.
So if you want to avoid extra server calls, I would recommend to use Silverlight which can hold TCP channel from the client.
Thus it is easier to handle this in case of silverlight.
If you want only HTML, then there is no other way than to call XMLHttpRequest 's continuously. ...
|
|
|
|
|
I am using a GridView to get access to (.pdf) files returned from a database search. The applicable column will always be indexed at [6] but the ROW will vary depending on the users selection. I am using this snippet to get the (pdf) name so I can pass it to the Process.Start() for Adobe:
____string pdf = GridViewResults.Rows[0].Cells[6].Text;____.
There are two issues that are giving me a problem. First is how do I get the ROW number of the selected line in the grid. The second is this; I have tied the code to the "SelectedIndexChanged" event because there apparently is no "Click" event for the grid (as in C# Apps), but when I run the application, the event is not firing. I looked for an AutoPostback setting with the idea that it might be required to reset the page, but there is none for the GridView. Where do I go from here?
Thanks in advance for the help...Pat
|
|
|
|
|
Hi,
I have a button which needs to download the file, simaltaneously it has to enable or disable the linkbutton on a click event. I went for the following code which never works for me.. The problem is there in writing the file in response. Any idea is highly valuable.
Thanks in advance..
Given the code below..
----
LinkButton1.Enabled = false;
System.IO.FileStream fs = null;
fs = System.IO.File.Open("c://4377.doc", System.IO.FileMode.Open);
byte[] btFile = new byte[fs.Length];
fs.Read(btFile, 0, Convert.ToInt32(fs.Length));
fs.Close();
Response.AddHeader("Content-disposition", "attachment; filename=4377.mpp");
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(btFile);
Response.End();
-----------
Thanks
Maheshkumar
|
|
|
|
|
Are you getting an error?
If you want the link button to be disabled once you've clicked it and the page is processing you'll have to use javascript to disable it.
|
|
|
|
|
Used the javascript option but there is no use. It remains the same.
I called the javascript function in the clientclick event of the button and gave the following line.
document.getElementById("LinkButton1").disabled=false;
Thanks
Maheshkumar B
|
|
|
|
|
You will need to use the client id of the link button in your javascript, something like:
document.getElementById("<%=LinkButton1.ClientID%>").disabled = false;
|
|
|
|
|
how to open a page in new window, i'm using the xml files to get the file name and the code is
<Description>Converts BBCode to XHTML in the comments</Description>
<Author><a href="http://dotnetblogengine.net">BlogEngine.NET< target="_blank" /a></Author>
<AdminPage />
<Enabled>true</Enabled>
so and so ..... but it is opening in the existing window ..please help me..
|
|
|
|
|
This code is looking fine.Did you check the view source whether this is rendering properly or not?
|
|
|
|
|
|
If it is an anchor tag, please ensure you are using html.
Also if you want this anchor tag to be placed on an HTML document please use
<a href="http://dotnetblogengine.net" target="_blank" >BlogEngine.NET</a>
rather than
<a href="http://dotnetblogengine.net">BlogEngine.NET< target="_blank" /a>
as target ="_blank" is misplaced on your place.
modified on Wednesday, July 15, 2009 11:48 AM
|
|
|
|
|
I'm reading excel file data using sql bulk copy and uploading the same inside sql server database:
My current code is:
public bool ImportMethod()
{
string sqlConnectionString = "Data Source=192.1.1.10;Initial Catalog=GePReleaseStatus;user=sa;password=sa;Integrated Security=True";
//Create Connection to Excel WorkBook
using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
{
connection.Open();
OleDbCommand command = new OleDbCommand("SELECT SrNo AS SrNo,Module AS vcrModule,DefectNoClientName AS intDefectNo, FeratureID AS intFeratureID,Priority AS vcrPriority,Description AS vcrDescription FROM [eContract_4.0.13$]", connection);
using (System.Data.Common.DbDataReader dr = command.ExecuteReader())
{
// Bulk Copy to SQL Server
using (System.Data.SqlClient.SqlBulkCopy bulkCopy = new System.Data.SqlClient.SqlBulkCopy(sqlConnectionString))
{
bulkCopy.DestinationTableName = "ExcelData";
bulkCopy.WriteToServer(dr);
return true;
}
}
connection.Close();
}
}
Now the problem is:-
1) I'm unable to read the excel, as it has formatted cells at top ?
(common error: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).)
2) how to read the excel from any particular row ?
3) Is it possible to read multiple sheets from a single excel file, how ?
Thanks
Raj
raj
|
|
|
|