|
Ersan Ercek wrote: protected void Page_Preload()
Where is parameter Object and EventArgs ?
Try this. Its work for me
protected void Page_Preload(object sender, EventArgs e)
{
for (int i = 1; i <= 2; i++)
{
LinkButton bottomLink = new LinkButton();
LiteralControl bottomLiteral = new LiteralControl(" ");
bottomLink.Text = i.ToString();
pnlBottom.Controls.Add(bottomLink);
pnlBottom.Controls.Add(bottomLiteral);
bottomLink.Click += new EventHandler(bottomLink_Click);
}
}
I will suggest you to create all the control on Pre_Init()
|
|
|
|
|
Thanks for the reply but it is not working. . That why I am getting crazy.
Do you think pnlBottom (panel) would be created before_preinit, since I added it on HTML page...
Thanks again.
|
|
|
|
|
Ersan Ercek wrote: Do you think pnlBottom (panel) would be created before_preinit, since I added it on HTML page
you means, like this way ?
<asp:Panel ID="pnlBottom" runat="server">
</asp:Panel>
|
|
|
|
|
Excatly... do you think this is the problem?
|
|
|
|
|
I did the same and I got two link in my page "1 " and "2 " .
|
|
|
|
|
does the link or the code you attached work?
|
|
|
|
|
okay I solve the problem for now
onclientclik ? what was that? I changed it with click
|
|
|
|
|
Ersan Ercek wrote: onclientclik ? what was that? Smile I changed it with click Smile
So, You didn't checked my code that I have replied on First time. .
|
|
|
|
|
no i did not...
|
|
|
|
|
Hello,
Thank you for reading. Here is my situation. I have an UpdatePanel and within in I have 2 dropdownlists. I want to show the second ddlist only when a specific value is chosen in dropdownlist1. I used Javascript/label etc on the selectedIndexChanged event but still does not work. The event gets fired and I stepped thru the code with no problems but it does not render on screen. Code snippet below. All help is wonderfully,gratefully and thankfully appreciated.
Front End
<asp:UpdatePanel ID="updPanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlTest1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlTest1_IndexChanged">
<asp:ListItem Value="" Text="Select one"></asp:ListItem>
<asp:ListItem Value="Matt" Text="Matt"></asp:ListItem>
<asp:ListItem Value="Robin" Text="Robin"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlTest2" runat="server" style="visibility:hidden;display:none;">
<asp:ListItem Text="Select One" Value=""></asp:ListItem>
<asp:ListItem Text="Tom" Value="Tom"></asp:ListItem>
<asp:ListItem Text="John" Value="John"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
And the Codebehind is as follows:
Protected Sub ddlTest1_IndexChanged(ByVal sender As Object, ByVal e As EventArgs)
If ddlTest1.SelectedValue = "Robin" Then
Dim script As String = "<script type='text/javascript'>var elem=document.getElementById('" & Me.ddlTest2.ClientID & "');elem.style.visibility='visible';elem.style.display='block';</script>
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "newKeyVal", script, True)
Else
Dim script As String = "<script type='text/javascript'>var elem=document.getElementById('" & Me.ddlTest2.ClientID & "');elem.style.visibility='hidden';elem.style.display='block';</script>"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType (), "newKeyVal", script, True)
End If
End Sub
|
|
|
|
|
Do not put the both Dropdown list in Same Update Panel. Place it in two different Update Panel and Make the UpdateMode="Conditional" for the Second Updatepanel and call UpdatePanel2.Update() from SelectedIndexChanged event of Dropdownlist1.
Hope this will help you
|
|
|
|
|
Hey... Why do you require to pass a script to the client and process to change the visibility of the control, when you simply can change Me.ddlTest2.Visible = false
By this way you are eventually making your response smaller, as if a servercontrol visible is false, it will not rendered to the client.
Or if you need Javascript fix, just use simple AJAX call (May be using ICallBackEventHandler) from the Javascript, and get the status of the Clientside control, and do display=none from javascript.
Dont need UpdatePanel for such a small need.. .
|
|
|
|
|
hi guys please help me !
iam using "Microsoft.Office.Interop.Word.ApplicationClass" for exporting data from DB to word document. it works fine on server where i published the application. but from my machine is shows the following error:-"System.Runtime.InteropServices.COMException: Cannot activate application"
code is.......
public static bool Export( string questionID, int questionNumber, object filename )
try
{
bool result=false;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.Word.Document wordDoc = wordApp.Documents.Add( ref missing, ref missing, ref missing, ref missing );
...................
wordApp.Selection.TypeParagraph();
wordDoc.SaveAs( ref filename, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing );
wordDoc.Close( ref missing, ref missing, ref missing );
wordApp.Application.Quit( ref missing, ref missing, ref missing );
return result;
}
--------------------
1. already i configured security setting for word in DCOMcnfg(added network service, aspnet and set access permission to full control and rebooted the system) though iam getting the same error.
2. i changed application platform to x86 still problem continues.....
waiting for help !
thanx
|
|
|
|
|
Code looks good.
Do you have the same version of office installed?
Is it Office 2007 installed in your machine?
|
|
|
|
|
yes, we installed ms-office 2007
|
|
|
|
|
i removed worddoc.active() function from code bcoz it was showing error in server. so now after publishing i am getting new error....
error is:---
System.Runtime.InteropServices.COMException: Word has encountered a problem.
|
|
|
|
|
Hey..Is it the same old problem with Word Templates being corrupted. Open word manually and see.. if it crashes or not.
If it is the same problem, then you need to get Normal.dot file and replace it with your one.
|
|
|
|
|
Thanks for suggestion
i tried what u said but MS-word(open, create, save) is working fine on server and in web app export/import using localhost is also working smoothly on server. every thing is ok but when the same web app accessed from my local machine it shows the following error.
System.Runtime.InteropServices.COMException: Word has encountered the problem
|
|
|
|
|
hey it's working yaar !
i placed "identity" tab with property "imposonate=true" in web.config and it's working fine
|
|
|
|
|
hey it's working yaar !
i placed
"identity" tab with property "imposonate=true",username="XXX" password="XXX"> in web.config and it's working fine
|
|
|
|
|
Hi all.
I have an action result in a controller which is hooked up to a view. This view loads twice when i refresh the page and inserts a viwed counter into the DB twice (which is wrong).
Is there any reason for this multiple load? Or a way i can check and then bypass it?
I have looked through all img src attributes, as this is one of the causes, but the problem still persistss.
Any help would be awesome.
|
|
|
|
|
The only reason that I can think of that would cause you to have your view load twice would be if your view contains a partial view that is calling code back that returns the view a second time, or perhaps an ajax call that is formatted incorrectly...
|
|
|
|
|
|
Hello
Just for the rendering purpose I have created a htmlform object added the Datagrid to that form then rendered the form with the RenderControl method then removed the Datagrid from the form then disposed the form but still when it reaches to the render event and touches the base.render line it starts displaying Error Message-> A page can have only one server-side Form tag.Please help me how can I handle this situation.
|
|
|
|
|
The problem is HtmlForm cant be two for each page. Why do you need to create a form when there is one HtmlForm object there within the Page. Create Datagrid within the form, do your job and then remove it..
What the problem using the existing one?
|
|
|
|