|
hi
i want required filed validation on button control.
pls help me
|
|
|
|
|
What do you mean?
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
Hi,
I am using asp.net 2.0 and working with creating reports.
I have shown the Output (Report) in the web page using several GridView, Details view, etc. by binding with the database Sql Server.
I wish to SAVE the entire (report) page, how I am seeing the page actually in the page, as MS WORD (.doc) format. Because I wish to send this file as a attachment to the client.
Anyone can give me the clue for this? Thanks.
Regards,
Jay
|
|
|
|
|
hi
use the code given below this will be usefull
protected void word_Click(object sender, EventArgs e)
{
//string attachment = "attachment; filename=f.xls";
SqlDataAdapter da = new SqlDataAdapter("select * from empdata", cn);
DataSet dsExport = new DataSet();
da.Fill(dsExport);
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw =
new System.Web.UI.HtmlTextWriter(tw);
DataGrid dgGrid = new DataGrid();
dgGrid.DataSource = dsExport;
// //Report Header
hw.WriteLine("" +
"Report for the Employee Information: " +
"");
//hw.WriteLine(" ");
//// Response.AddHeader("emp info", attachment);
// // Get the HTML for the control.
dgGrid.HeaderStyle.Font.Bold = true;
dgGrid.DataBind();
dgGrid.RenderControl(hw);
// // Write the HTML back to the browser.
Response.ContentType = "application/msword";
this.EnableViewState = false;
Response.Write(tw.ToString());
Response.End();
}
|
|
|
|
|
let me know the given really helps u or not?
don't forget to reply
|
|
|
|
|
Hi,
I hope, what you have given is correct. Can you please explain me or refer a article for this to understand.
Because I am very new to this. Please help me. Thanks
Regards,
Jay
|
|
|
|
|
hi jay
first u show me the coding u have done
|
|
|
|
|
Hi,
I dont know, where to start with. Because,
1. I neeed to create aroud 10 Table format information, which may be created in 6 web pages (aspx) NOT A SINGLE Web page. If I combine everything in one page, the page length is too long.
2. I wish to combine the all the page's output and WRITE in a single WORD file.
3. The WORD file has contains some output fron WebPage and also some Sataic contents like NOTE,Company address, etc.
4. what is word_Click in your code?? Whether after clicking the button, then only the web page is displayed and word file is wrote?
Regards,
Jay
|
|
|
|
|
word_click is just list button_click.......ok
here button text&id is word
|
|
|
|
|
Hi,
I have got the below error in the following line
GridView1.RenderControl(hw);
Http Exception:
Control 'ctl00_ContentPlaceHolder1_GridView1' of type 'GridView' must be placed inside a form tag with runat=server.
Regards,
Jay
|
|
|
|
|
as an example take a sample grid and populate with data from database and then press button
here text and id of button is word
protected void word_Click(object sender, EventArgs e)
{
//string attachment = "attachment; filename=f.xls";
SqlDataAdapter da = new SqlDataAdapter("select * from empdata", cn);
DataSet dsExport = new DataSet();
da.Fill(dsExport);
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw =
new System.Web.UI.HtmlTextWriter(tw);
//DataGrid dgGrid = new DataGrid();
//dgGrid.DataSource = dsExport;
DataGrid1.DataSource = dsExport;
// //Report Header
hw.WriteLine("" +
"Report for the Employee Information: " +
"");
//hw.WriteLine(" ");
//// Response.AddHeader("emp info", attachment);
// // Get the HTML for the control.
//dgGrid.HeaderStyle.Font.Bold = true;
//dgGrid.DataBind();
//dgGrid.RenderControl(hw);
DataGrid1.HeaderStyle.Font.Bold = true;
DataGrid1.DataBind();
DataGrid1.RenderControl(hw);
// // Write the HTML back to the browser.
Response.ContentType = "application/msword";
this.EnableViewState = false;
Response.Write(tw.ToString());
Response.End();
}
|
|
|
|
|
it is working fine for me i tested again
ok
bye
best of luck
|
|
|
|
|
Hi,
Thanks for your guidance. I am working on this now. Hopefully it works for me also.
Regards,
Jay
|
|
|
|
|
Hi,
In order to avoid the above said error, I have addded the below code in my code behind. Now it works fine. THANKS
public override void VerifyRenderingInServerForm(Control control)
{
}
Regards,
Jay
|
|
|
|
|
Hi all
I am display XML data in a datagrid
-----------------------------------------------
Dim Products = New DataSet
Products.ReadXml(MapPath("Products.xml"))
Datagrid1.DataSource = Products
Datagrid1.DataBind()
-----------------------------------------------
In the xml i have a colomn like "Price"
I want to calculate the total Price in the datagrid row and display into a label
Can any one give me an idea
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
just loop thru the column from the dataset and sum it
price=0
for(int i=0;i<products.tables[0].rows.count;i++)
price+=convert.todouble(products.tables[0].rows[i]["price"]);
<div="" class="ForumSig">Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
HI thx for reply
I want to calculte the total price after displaying in the Datagrid
I am calculating the Row Total and Colomn Total
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
Hi guys
I am listing more than 100 items in a dropdownlist.
How to select the items just by typing first few letters through keyboard, so that the items starting with that letters is selected?
For example, am having "a,ab,abc,abcde,abcdef,abcdefg..." in the list.
When i type/press 'a' then 'b' and then 'c',now the item 'abc' should be the selecteditem in the order of display.
Can anyone please help me?
Thanks
|
|
|
|
|
|
Thanks
But i have to code in VS.NET 2003 with ASP.NET 1.1 only.
Please tell me!
|
|
|
|
|
|
Hi all,
I want to add the selected element from one listbox to another listbox and remove also on button click event >(button text for add) and <(button text for remove).
Also I need to add all the element from one listbox to another and remove also on button click event >>(button text for add all) and <<(button text for remove all).
I want to do this with Javascript.
Please help me as I have to do this by today.
Thanks in advance.
|
|
|
|
|
Hey Varsha,
Use this code. This code has a ability to move the Selected Items from source to target. You can alter it as you like.
function AddItem(src,target){
for (i=src.length-1; i>=0; i--){
if (src[i].selected){
for (j=0; j < target.options.length; j++){
if (src.options[i].text.toUpperCase() < target.options[j].text.toUpperCase())
break;
}
var oOptions = document.createElement("option");
target.options.add(oOptions,j);
oOptions.value=src.options[i].value;
oOptions.innerHTML=src.options[i].innerHTML;
src.options.remove(i);
}
}
}
|
|
|
|
|
Thanks for the reply sir. I got some code but its not working I am not able to track whats wrong.
<html>
<head>
<script language="JavaScript">
function f_optionMove(s_from, s_to)
{
alert(s_from);
var e_from = document.forms['test_form'].elements[s_from],e_to = document.forms['test_form'].elements[s_to];
alert(e_from);
if (!e_from)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
if (!e_to)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
var n_moved = 0;
for (var i = 0; i < e_from.options.length; i++)
{
if (e_from.options.selected)
{
e_to.options[e_to.options.length] = new Option(e_from.options.text, e_from.options.value);
n_moved++;
}
else if (n_moved)
e_from.options[i - n_moved] = new Option(e_from.options.text, e_from.options.value);
}
if (n_moved)
e_from.options.length = e_from.options.length - n_moved;
else
alert("You haven't selected any options");
}
function f_optionMoveAll(s_from, s_to)
{
var e_from = document.forms['test_form'].elements[s_from],e_to = document.forms['test_form'].elements[s_to];
if (!e_from)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
if (!e_to)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
e_to.options.length = 0;
for (var i = 0; i < e_from.options.length; i++)
e_to.options = new Option(e_from.options.text, e_from.options.value);
e_from.options.length = 0;
}
function f_selectAll (s_select)
{
var e_select = document.forms['test_form'].elements[s_select];
for (var i = 0; i < e_select.options.length; i++)
e_select.options.selected = true;
}
</script>
</head>
<body>
<form id="test_form" name="test_form" runat="server">
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td>
<select multiple name="source" style="width: 170px; height: 170px">
<option>Vishal</option>
<option>Pooja</option>
<option>Dnyandeo</option>
<option>Varsha</option>
<option>Aditi</option>
<option>Nilesh</option>
</select>
</td>
<td>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td>
<input type="Button" style="width: 200px;" value="Add Selected >>" onclick="f_optionMove('source', 'destination')">
</td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Remove Selected <<" onclick="f_optionMove('destination', 'source')">
</td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Add All >>" onclick="f_optionMoveAll('source', 'destination')">
</td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Remove All <<" onclick="f_optionMoveAll('destination', 'source')">
</td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Select All Sources" onclick="f_selectAll('source')"></td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Select All Destinations;" onclick="f_selectAll('destination')"></td>
</tr>
</table>
</td>
<td>
<select multiple name="destination" style="width: 170px; height: 170px">
</select>
</td>
</tr>
</table>
</form>
</body>
</html>
Please tell me where I am going wrong.
|
|
|
|
|
The corrected script is,
<script language="JavaScript">
function f_optionMove(s_from, s_to)
{
var e_from = document.forms['test_form'].elements[s_from],e_to = document.forms['test_form'].elements[s_to];
if (!e_from)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
if (!e_to)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
var n_moved = 0;
for (var i = 0; i < e_from.options.length; i++)
{
if (e_from.options[i].selected)
{
e_to.options[e_to.options.length] = new Option(e_from.options[i].text, e_from.options[i].value);
n_moved++;
}
else if (n_moved)
e_from.options[i - n_moved] = new Option(e_from.options[i].text, e_from.options[i].value);
}
if (n_moved)
e_from.options.length = e_from.options.length - n_moved;
else
alert("You haven't selected any options");
}
function f_optionMoveAll(s_from, s_to)
{
var e_from = document.forms['test_form'].elements[s_from],e_to = document.forms['test_form'].elements[s_to];
if (!e_from)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
if (!e_to)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
e_to.options.length = 0;
for (var i = 0; i < e_from.options.length; i++)
e_to.options[e_to.options.length] = new Option(e_from.options[i].text, e_from.options[i].value);
e_from.options.length = 0;
}
function f_selectAll (s_select)
{
var e_select = document.forms['test_form'].elements[s_select];
for (var i = 0; i < e_select.options.length; i++)
e_select.options[i].selected = true;
}
</script>
|
|
|
|