|
Hi,
its realy very simple question
try below code on ButtonClick event.
Double click on button.
Textox1.Text = ButtonA.Text;
Write this code on every button click, just change Button...
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
Do you want this to happen immediately, or for the page to post back ? If the former, you need to write javascript to run when the button is clicked, to find the textbox control and put text in it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
Does anyone know if using SSL is the best method to provide a secure connecion between SQL Server and a Web Server?
cheers
|
|
|
|
|
Hi all,
I sit with an issue and have absolutely no idea why it is happening.
I have a DropDownList, as follow:
<asp:dropdownlist id="ddlPaymentMethod" runat="server" onselectedindexchanged="ddlPaymentMethod_SelectedIndexChanged">
</asp:dropdownlist>
Then in the code-behind I have the following:
protected void ddlPaymentMethod_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlPaymentMethod.SelectedIndex.ToString() != "")
{
SetDivVisibility(ddlPaymentMethod.SelectedItem.Value.Trim());
}
}
But for some reason, when I run the program, and change the value within the DropDownList, it never enters the SelectedIndexChanged event.....
Any ideas or solutions would be greatly appreciated
Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Hi,
set property AutoPostBack = True in Dropdown list...
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
Thanks, working like a dream now.
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Hi
I currently use Visual Web Developer 2005 Express Edition to write .net and c# code.
Does anyone know of any problems with uploading files from Visual Wev Developer to a web server?
cheers
|
|
|
|
|
is there any specific problem that your are facing????
|
|
|
|
|
No I havent encountered any problems.
The reason I ask it because I am currently using VWD to upload to a citrix server and wondered if there was any problems with uploading to a web server?
cheers
|
|
|
|
|
I have a requirement.I have a user control in which based on the enum selection I need to add textbox or combobox at design time.For example if enum value = 0 then textbox should be added in usercontrol - if enum = 1 them combobox should be added.The changing of enum value will be done from form1.Means the
blank user control will be droped on the form.From that from I will change the enum value.Based on that
the control should be created.and the controll should hold all its properties.
Can any body help me for this.
|
|
|
|
|
Hello EveryOne
I want to use Excel file into my web project.So I add reference and use it.
It is run properly into My localHost but when I upload this site into my web server it is not running properly.
And showing following error :
“Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154”
And My method is following which is create the Excel Sheet.....
private void createDataInExcel(DataTable dt)
{
Excel.Application oXL;
Excel._Workbook oWB;
Excel._Worksheet oSheet;
Excel.Range oRng;
string strCurrentDir = Server.MapPath(".") + "\\reports\\";
try
{
oXL = new Excel.Application();
oXL.Visible = false;
oWB = (Excel._Workbook)(oXL.Workbooks.Add(System.Reflection.Missing.Value));
oSheet = (Excel._Worksheet)oWB.ActiveSheet;
int intdsCount = dt.Rows.Count;
int iRow = 2;
if (dt.Rows.Count > 0)
{
for (int j = 0; j < dt.Columns.Count; j++)
{
string a = dt.Columns[j].ColumnName;
oSheet.Cells[1, j + 1] = dt.Columns[j].ColumnName;
}
// For each row, print the values of each column.
for (int rowNo = 0; rowNo < dt.Rows.Count; rowNo++)
{
for (int colNo = 0; colNo < dt.Columns.Count; colNo++)
{
oSheet.Cells[iRow, colNo + 1] = dt.Rows[rowNo][colNo].ToString();
}
iRow++;
}
}
oSheet.get_Range("A1", "IV1").Font.Bold = true;
oRng = oSheet.get_Range("A1", "IV1");
oRng.EntireColumn.AutoFit();
oXL.Visible = false;
oXL.UserControl = false;
FileInfo[] files=new DirectoryInfo(Server.MapPath("~\\Admin\\reports\\")).GetFiles("*.xls");
check_login();
string strUserName = Session["UserName"].ToString();
string strFile = String.Concat(strUserName, "_" , "report" , System.DateTime.Now.Ticks.ToString() , ".xls");
foreach(FileInfo fi in files)
{
string[] arrFileInfo = fi.ToString().Split('_');
if (arrFileInfo[0].ToString() == strUserName)
{
if (fi.ToString().Trim() != strFile)
{
fi.Delete();
}
}
}
oWB.SaveAs(strCurrentDir + strFile, Excel.XlFileFormat.xlWorkbookNormal,
null, null, false, false, Excel.XlSaveAsAccessMode.xlShared, false, false, null, null, null);
oWB.Close(null, null, null);
oXL.Workbooks.Close();
oXL.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(oRng);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oWB);
string displayScript = "<script language='javascript'>" +
" winOpen('ExcelSheet.aspx?ExcelFile=" + strFile + "')" +
" </script>";
Page.RegisterStartupScript("PopupScript", displayScript);
}
catch (Exception theException)
{
Response.Write(theException.Message);
}
}
Thnax and regards
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
Hi,
I want to develop a comparison chart. For example,
You want to start a new restaurant in a particular place. So, what you do is you will list all the items that are being supplied by the restaurents already available on X-axis and all the restaurents on Y-axis.
Now you put a tick mark against each item taking one restaurent at a time.
item1 item2 item3 item4
Rest1 . .
Rest2 . . .
Rest3 . .
My report should look something like this and i am working in asp.net 1.1
Thank You in advance
Thank you
|
|
|
|
|
|
Hi,
This is from Chandrakanth.
Now i am uploading Image in to Sqlserver2005.
I have written coding like this using Enterprise Library
protected void btnUpload_Click(object sender, EventArgs e)
{
if (upXLTalisma.PostedFile != null)
{
if (upXLTalisma.PostedFile.ContentLength > 0)
{
HttpPostedFile objHttpPostedFile = upXLTalisma.PostedFile;
if (CheckValidFileType(objHttpPostedFile.FileName))
{
int intContentlength = objHttpPostedFile.ContentLength;
byte[] bytImage = new byte[intContentlength];
objHttpPostedFile.InputStream.Read(bytImage, 0, intContentlength);
KF.Search.StoreImage(Convert.ToByte(bytImage));
}
}
}
}
public static bool CheckValidFileType(string strImage)
{
string strImageFile;
strImageFile = strImage;
if (strImageFile.LastIndexOf(".") == -1)
return (false);
int i = strImageFile.LastIndexOf(".");
strImageFile = strImageFile.Substring(strImageFile.LastIndexOf(".") + 1);
return (strImageFile.ToUpper() == "JPG");
}
This is the code i am using in Class file
public static void StoreImage(byte strImage)
{
try
{
Database objDataBase = DatabaseFactory.CreateDatabase();
DbCommand objDbCommand = objDataBase.GetStoredProcCommand("STP_KF_IMages");
objDataBase.AddInParameter(objDbCommand, "@Image", DbType.Binary, strImage);
objDataBase.ExecuteNonQuery(objDbCommand);
}
catch (Exception Ex)
{
throw new Exception(Ex.Message.ToString());
}
}
but i am getting error in this line,
KF.Search.StoreImage(Convert.ToByte(bytImage));
and Saying
"Unable to cast object of type 'System.Byte[]'to 'System.IConvertible'. "
Can any one suggest me what to do for that coding.
Thanks And Regards
Chandrakanth
Chandrakanth
|
|
|
|
|
mrgaddam wrote: objHttpPostedFile.InputStream.Read(bytImage, 0, intContentlength);
Oops! The Read method returns the number of bytes actually read, which can be smaller than the number of bytes requested. If you ignore the return value of the method, you don't know how much of the data that you actually get.
You have to get the return value from the method to see how much data was read, and loop until you have read all of the data (you reach content length, or the method returns zero).
mrgaddam wrote: KF.Search.StoreImage(Convert.ToByte(bytImage));
You can't convert a byte array into a single byte.
mrgaddam wrote: public static void StoreImage(byte strImage)
This method takes a single byte as parameter. That is truly pointless as you can't store an image in a single byte. Change the method to take an array of bytes.
Using hungarian notaion to specify data type is rather pointless in a strongly typed language. And if you specify the wrong type, as you have here when you gave a byte variable a name that says that it's a string, it's only confusing.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi,
Once again this is from Chandrakanth.
Can you please tell me what are all things have to follow in Code
Thanks and Regards
Chandrakanth
Chandrakanth
|
|
|
|
|
mrgaddam wrote: Can you please tell me what are all things have to follow in Code
I already did that.
Read my previous post, and if there is anything that you don't understand, say what it is.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
iam having only one text box which is useful to enter different datatype values say date,number,string etc now my requirement is the first data type is date datatype ..how i can check if the user enters some text in the text box is a valid date formate or not..if he enters other than date then how i can say that the value enter is not in date format
|
|
|
|
|
Hi jagadeeshkumar2106,
suppose u have a one textbox names text1 ok now try this code
// Code is here.
try
{
DateTime d = new DateTime();
d = Convert.ToDateTime(Text1.Text.Trim());
// If it will not be in proper format then it will throw an error ok
// if u know error type about converting then u can also write one another catch block regarding that.
}
catch(Exception ex)
{
Response.Write("Enter Date is not in valid format");
}
I hope it will work.
modified on Friday, December 14, 2007 7:14:25 AM
|
|
|
|
|
Hi!
I am trying to display a three level datagrid drill down. dont know what i am doing wrong. its not working on the third drill down as its not calling itemcommand event on the second datagrid.
also, there is a massive amout of text inviewstate. I want an efficient drill down. how could this be achieved. below are my codes for readability. please someone point me to correct direction.
aspx
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="gvPropertyAssetCapexSummary" DataKeyField="buildingcomponentid" runat="server" Width="472px" BorderColor="Tan" BorderWidth="1px" BackColor="LightGoldenrodYellow" CellPadding="2" GridLines="None" ForeColor="Black" AutoGenerateColumns="False">
<SelectedItemStyle ForeColor="GhostWhite" BackColor="DarkSlateBlue" ></SelectedItemStyle>
<AlternatingItemStyle BackColor="PaleGoldenrod"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True" BackColor="Tan" Font-Names="verdana" Font-Size="8pt"></HeaderStyle>
<ItemStyle Font-Names="verdana" Font-Size="8pt"/>
<FooterStyle BackColor="Tan"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="buildingcomponentid" HeaderText="buildingcomponentid" Visible="false"></asp:BoundColumn>
<asp:TemplateColumn>
<HeaderStyle Width="9px"></HeaderStyle>
<ItemTemplate>
<asp:ImageButton id="btnExpandJob" runat="server" Width="9px" Height="9px" ImageUrl="/Images/Plus.gif" CommandName="ExpandJob"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:PlaceHolder ID="ExpandJob" Runat="server" Visible="False">
</td></tr>
<tr><td >&nbsp;</td>
<td colspan="3">
<asp:DataGrid id="gvPropertyAssetCapexJob" DataKeyField="CapExJobNo" runat="server" Width="100%" BorderColor="Tan" BorderWidth="1px" BackColor="LightGoldenrodYellow" CellPadding="2" GridLines="None" ForeColor="Black" AutoGenerateColumns="False">
<SelectedItemStyle ForeColor="GhostWhite" BackColor="DarkSlateBlue"></SelectedItemStyle>
<AlternatingItemStyle BackColor="PaleGoldenrod"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True" BackColor="Tan" Font-Names="verdana" Font-Size="8pt"></HeaderStyle>
<ItemStyle Font-Names="verdana" Font-Size="8pt"/>
<FooterStyle BackColor="Tan"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="CapExJobNo" HeaderText="CapExJobNo" Visible="false"></asp:BoundColumn>
<asp:TemplateColumn>
<HeaderStyle Width="9px"></HeaderStyle>
<ItemTemplate>
<asp:ImageButton id="btnExpandJobDetail" runat="server" Width="9px" Height="9px" ImageUrl="/Images/Plus.gif" CommandName="ExpandJobDetail"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:PlaceHolder ID="ExpandJobDetail" Runat="server" Visible="False">
</td></tr>
<tr><td>&nbsp;</td>
<td colspan="3">
<asp:DataGrid DataSource='<%# getJobDetail(DataBinder.Eval(Container, "DataItem.CapExJobNo")) %>' id="gvPropertyAssetCapexJobDetail" runat="server" Width="100%" BorderColor="Tan" BorderWidth="1px" BackColor="LightGoldenrodYellow" CellPadding="2" GridLines="None" ForeColor="Black" AutoGenerateColumns="False">
<SelectedItemStyle ForeColor="GhostWhite" BackColor="DarkSlateBlue"></SelectedItemStyle>
<AlternatingItemStyle BackColor="PaleGoldenrod"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True" BackColor="Tan"></HeaderStyle>
<FooterStyle BackColor="Tan"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="AssetDescription" HeaderText="Asset Description"></asp:BoundColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="DarkSlateBlue" BackColor="PaleGoldenrod"></PagerStyle>
</asp:DataGrid>
</asp:PlaceHolder>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="DarkSlateBlue" BackColor="PaleGoldenrod"></PagerStyle>
</asp:DataGrid>
</asp:PlaceHolder>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="DarkSlateBlue" BackColor="PaleGoldenrod"></PagerStyle>
</asp:DataGrid>
vb
Public Partial Class testfunc
Inherits System.Web.UI.Page
Private domainid As Integer
Private locationid As Integer
Private buildingcomponentid As Integer
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim mydal As New clsDAL
domainid = 1204111332
locationid = 27195
buildingcomponentid = 0
If Not IsPostBack Then
Try
Dim dtPropertyCapex As DataSet = mydal.getAssetsCapexByProperty(domainid, buildingcomponentid, locationid)
If Not dtPropertyCapex Is Nothing Then
gvPropertyAssetCapexSummary.DataSource = dtPropertyCapex
gvPropertyAssetCapexSummary.DataBind()
End If
Catch ee As Exception
mydal.UpdateErrorLog(ee.Message, ee.TargetSite.Name.ToString())
Throw ee
End Try
Try
Catch ex As Exception
End Try
End If
End Sub
Private Sub gvPropertyAssetCapexSummary_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles gvPropertyAssetCapexSummary.ItemCommand
Select Case e.CommandName
Case "ExpandJob"
Dim img As ImageButton
img = e.Item.Cells(1).FindControl("btnExpandJob")
If img.ImageUrl = "/Images/Plus.gif" Then
img.ImageUrl = "/Images/Minus.gif"
Else
img.ImageUrl = "/Images/Plus.gif"
End If
Dim exp As PlaceHolder
exp = e.Item.Cells(1).FindControl("ExpandJob")
Dim dgjob As DataGrid
dgjob = CType(e.Item.FindControl("gvPropertyAssetCapexJob"), DataGrid)
If (Not dgjob Is Nothing) Then
dgjob.DataSource = getJob(e.Item.Cells(0).Text)
dgjob.DataBind()
End If
exp.Visible = Not exp.Visible
End Select
End Sub
Public Function getJob(ByVal BCId As Integer) As DataSet
Dim myDal As New clsDAL
Dim dsPropertyAssetCapexSummary As DataSet
domainid = 1204111332
locationid = 27195
dsPropertyAssetCapexSummary = myDal.getCapitalExpenditureJob(domainid, BCId, locationid)
dsPropertyAssetCapexSummary = dsPropertyAssetCapexSummary
Return dsPropertyAssetCapexSummary
End Function
Private Sub gvPropertyAssetCapexJob_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
Select Case e.CommandName
Case "ExpandJobDetail"
Dim img As ImageButton
img = e.Item.Cells(1).FindControl("btnExpandJobDetail")
If img.ImageUrl = "/Images/Plus.gif" Then
img.ImageUrl = "/Images/Minus.gif"
Else
img.ImageUrl = "/Images/Plus.gif"
End If
Dim exp As PlaceHolder
exp = e.Item.Cells(1).FindControl("ExpandJobDetail")
Dim dgjobdetail As DataGrid
dgjobdetail = CType(e.Item.FindControl("gvPropertyAssetCapexJob"), DataGrid)
If (Not dgjobdetail Is Nothing) Then
dgjobdetail.DataSource = getJobDetail(e.Item.Cells(0).Text)
dgjobdetail.DataBind()
End If
exp.Visible = Not exp.Visible
End Select
End Sub
Public Function getJobDetail(ByVal CapexJObNo As Integer) As DataSet
Dim myDal As New clsDAL
Dim dsPropertyAssetCapexSummary As DataSet
domainid = 1204111332
locationid = 27195
buildingcomponentid = 0
dsPropertyAssetCapexSummary = myDal.getCapitalExpenditureJobDetail(domainid, buildingcomponentid, locationid, CapexJObNo)
Return dsPropertyAssetCapexSummary
End Function
End Class
thanks in advance.
|
|
|
|
|
could someone please help me?
|
|
|
|
|
Hi Clever People.
I have create an application that exports data to Excel. It first writes the data to a FileStream where it will ask you if you want to open or save the Excel file. Now the problem is that it works very well on our one server. Unfortunately we decided to move all applications accross to a different server.
They both are identical where setup is concerned, but for some or other reason I am getting the Following Error when trying to Export to Excel.
InvalidOperationException was unhandled by user code.
Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Can anyone tell me what we might have missed please?
Kind regards,
Elizma
|
|
|
|
|
Elizma wrote: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
I have not experienced this yet. But Google[^] returned many many results
|
|
|
|
|
Hi There,
Thanx for your reply. I also googled it before I came to post my question here. Unfortunatley nowhere in the over 600 results does it actually state what is causing it. They also cover the MsgBox problems. I am not making use of it. I am using the normal Filestream objects. Like I said. It works on our one server, but not on the new server. I am trying to figure out what we missed with the new server.
Kind Regards,
Elizma
|
|
|
|
|
Can you show a snippet of how you are streaming the file to the client?
|
|
|
|