|
Elena2006 wrote: once the process opened it should not create a new instance for another user only use the current instance.
Singleton ?[^]. You should be careful to make your instance thread safe. Because web applications are multi-threaded.
|
|
|
|
|
Hi,
I am having a gridview with a checkbox column.i want to export the selected rows which are checked to a word document.I have done the code to export to word document.There were other 2 options which are already complete.There is option to export each row seperately to word document and export the entire rows from gridview to word document.
This is a new requirement to export selected rows to word document.
i have done this much
int count = 0;
foreach (GridViewRow gv in gv1.Rows)
{
CheckBox cb = (CheckBox)gv.FindControl("chkSelect");
if (cb.Checked)
{
count++;
}
}
I was able to get the count of the selected rows.How can i take the selected recordsand export to a word document.I need the sample code of that part.This is very urgent.Please help.
Thanks
Anup
|
|
|
|
|
What is Gridbiew's data source type ? I assume it's a DataTable. So you could do the following.
DataTable dt = (DataTable)gv.DataSource;
int count = 0;
foreach (GridViewRow gv in gv1.Rows)
{
CheckBox cb = (CheckBox)gv.FindControl("chkSelect");
if (cb.Checked)
{
DataRow row = dt.Rows[count];
count++;
}
}
|
|
|
|
|
Gridbiew's data source is datatable as you said.
I want to export the selected row to a word document.If i have selected 10 rows how can i get that rows and assign to another datatable.
|
|
|
|
|
Create a new DataTable instance and add this rows to there like DataTable.Rows.Add(row)
|
|
|
|
|
DataTable.Rows.Add(row) cannot be used since we cannot add an existing row to another datatable.
i have used
dt1 = dt.Clone()
dt1.ImportRow(row)
but it there i'll get only the last row.I want all the selected row.Please help
|
|
|
|
|
is there any private key or unique table's field in the record?
if there is any unique field in data that you bind to gridview than assign it to hiddenfield control in your gridview (like you put checkbox control in your gridview).
Arraylist arrID = new arraylist();
foreach (GridViewRow gv in gv1.Rows)
{
CheckBox cb = (CheckBox)gv.FindControl("chkSelect");
if (cb.Checked)
{
HiddenField hf = (HiddenField)gv.FindControl("HiddenFieldNames");
arrID.add(hf.value);
}
}
DataTable dbTable = QueryBackToDB(arrID);
then you can query arrID to your database then ..... walah...there's your selected record (dbTable in code example, above).
this will query back to your database again, but at least, the data will be reliable.
you can always try to get the index where your checkbox is checked
try to loop with [for], and don't with [for each] so you can get the index easily. then you match with the index from your search with the index in datatable that you bind to gridview.
i hope this can help you.
|
|
|
|
|
I have already done what you have told,i am already having all the records in datable so need to query it again from database.
here is what i have done
DataTable dt = searchDatatable();
DataTable dt1 = new DataTable();
int count = 0;
DataRow row=null;
foreach (GridViewRow gv in gv1.Rows)
{
CheckBox cb = (CheckBox)gv.FindControl("chkSelect");
if (cb.Checked)
{
row = dt.Rows[count];
//Take necessary values from row
dt1 = dt.Clone();
count++;
foreach (DataRow dr in dt.Rows)
{
dt1.ImportRow(dr);
}
}
}
this will return only the last row,i want all the rows which r checked.I have spend a long time for this and its very urgent.
Please help
|
|
|
|
|
hello Anupbala,
i'm sorry that i can't reply ASAP due yesterday i have employee meeting.
have you find the solution?
if not, you didn't do exactly what i have told you, if i look in to your code.
you need to do the process individually. don't grouping them in one looping process.
this what i mean :
Arraylist arrDataToQuery = GetAllTheIDWhenCheckboxIsChecked();
Datatable dtQueryResult = QueryResult(arrDataToQuery);
gvDontCareItsName.DataSource = dtQueryResult;
gvDontCareItsName.Databind();
hope this help, if u're not dead with this problem , or maybe you have won...
|
|
|
|
|
Hi Boku,
Thanks for your response,i have found a solution for this in the other way as i said.
i am already having the entire records in a datatable,so there is no need to query it back again.
here is my solution
DataTable dt = GetAllRows();
DataTable dt1 = dt.Clone();
int count = 0;
DataRow row = null;
foreach (GridViewRow gv in gv1.Rows)
{
CheckBox cb = (CheckBox)gv.FindControl("chkSelect");
if (cb.Checked)
{
row = dt.Rows[gv.RowIndex];
dt1.ImportRow(row);
count++;
}
}
dt1.AcceptChanges();
I am posting it as it comes helpful for somebody else
|
|
|
|
|
oh ok dude...
asp.net forum rocks... hehehe
|
|
|
|
|
remove the gridviewrow from the gv1.rows, which are the rows are not selected.
|
|
|
|
|
Hi All,
I am using Dundas for creating Chart. i am facing one problem. i have created one bar chart with one series. Now some bars are coming with one color.Now what i want is to set the color dynamically of all datapoints with different color.How will i achieve it when i have only one series. Can anybody tell me how can i set the different color for all the datapoints in single series.
Thanks in Advance
Avesh
|
|
|
|
|
Hi ,
I am using C# , asp.net2.0 , sql server 2005.
I am developing module which is to incorporate to main web site. In one of the module they have used sitemap Actually i have to create menu for my module and I am associating menu control to sitemap but it taking root sitemap.
can we use two sitemap in a project if not how can we make menu which has user based access.
please guide me
thank you
regards
imran khan
|
|
|
|
|
Is google[^] broken where you live ?
|
|
|
|
|
Hi,
I am developing a new web based application in which i am using black shades for background in the application using panels.
Where as the problem is i am not able to fill in the panel completely to the page. I am getting a white border. around the back panel.
Can any body suggest how to over come it.
I am basically new to ASP.NET and trying to learn things, if any one suggest any articles or links to improve. It will be of a great help for me.
Thankx in advance...
Jats
|
|
|
|
|
Did you try with change the border color with the pannel color?
---
when you desgined any asp.net web page always try to use table . it will help you !!!
|
|
|
|
|
Hi Abhijit,
Abhijit Jana wrote: when you desgined any asp.net web page always try to use table .
Using tables are nowadays not recommended. Because tables uses nested tags which makes the loading time more that using SPANs & DIVs. The file size also more than the pages which you divs & spans for layouts.
But me too used to use tables from the beginning itself and not able to switch to divs & spans. But I recommend the beginners to use DIVs & SPANs rather than TABLEs.
|
|
|
|
|
Venkatesh Mookkan wrote: Using tables are nowadays not recommended. Because tables uses nested tags which makes the loading time more that using SPANs & DIVs. The file size also more than the pages which you divs & spans for layouts.
True. But most of the programmers including me are bad in designing. Tables are easy way to implement.
|
|
|
|
|
N a v a n e e t h wrote: True. But most of the programmers including me are bad in designing. Tables are easy way to implement.
They may make your job easier, but have you considered their impact on the users of your system? The principal reason why using tables for layout is because it represents a misuse of the TABLE tag. The purpose of the TABLE tag in HTML is to display tabular data. Using tables for layout purposes will make it difficult for partially-sighted or blind people, who rely on screen reading technology, to use your site as the markup will be confusing for them. As a web developer, it is your responsibility to ensure that your site is accessible to all. Making design decisions that discriminate against people is not a good idea.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
You are correct. I should learn some design tips. But doing designs with CSS is irritating job for me . Do you have good CSS tutorial other than HTML dog ?
|
|
|
|
|
Hi Friends,
I have one doubt,in mozilla web browser when i select the dropdownlist means its getting the list but the dropdownlist extends the width in selecting the list.In IE its working properly.Can anyone tell me the solution please?..
Take Care
Thanks & Regards
Senthil Kumar
|
|
|
|
|
we are planning to buy VS 2008, I would like to know if buying one copy I can install it on my desktop and my laptop as long I am the only one using both. My boss said that is not true, Any idea? i was looking on Microsoft website, but i cant find any info about it. any help?
|
|
|
|
|
Hi dear,
well ya this is not possible as u got lisence for only one Member, bt if u try to buy the lisence for than one than obviously it cost much..
also u can call to miscosoft customer support for the same .
u will be better helped by them..
Regards,
Sulabh jain
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
does anyone know any good css tutorials to design a 800 x 600 website
thanks
|
|
|
|