|
Hi Michael,
In the MenuItems Click event handler, I did already set the ActiveViewIndex to the appropriate index depending on the MenuItem Click, so that should not be a problem. After I read your suggestions, I used SetActiveView instead of ActiveViewIndex. I did EnableViewState="true" for all of them, I even did EnableCaching="true" for the SqlDataSource. Everything works fine as they used to - Except the GridView disappears with edit, update, cancel, insert button clicks. You need to click on the MenuItem again to see it.
I was also thinking that its happening because of the MultiViews. But interestingly, even if I move my GridView out of the MultiView, still does the same. What a puzzle!!!
I am confident though that you can give me more clues!
Thanks so much.
Ekjon
|
|
|
|
|
First time here and I hope to get lucky
I have a really strange problem. My problem is that I can't add a DataGrid to a user control. When I have the code below in a control and register it in web.config it won't show up in the intellisense. If I comment out the DataGrid it works fine. The codebehind is empty.
I register the control in the web.config, but that shouldn't matter.
<code>
<![CDATA[<%@ Control Language="C#" AutoEventWireup="true" Codebehind="EBHObjectListFileControl.ascx.cs"
Inherits="EBHPresentation.Templates.Webcontrols.EBHObjectListFileControl" %>]]>
<asp:datagrid id="DataGridFileList" runat="server" onitemcommand="DataGridFileList_ItemCommand">
Font-Size="Small" ShowHeader="false" AutoGenerateColumns="false">
<columns>
<asp:boundcolumn datafield="Id" visible="false" />
<asp:boundcolumn datafield="FileName1" visible="false" />
<asp:boundcolumn datafield="Date" visible="true" />
<asp:templatecolumn>
<itemtemplate>
<asp:linkbutton id="LinkButtonOpenDocument" commandname="OpenFile" runat="server">
<%# DataBinder.Eval(Container.DataItem, "FileName2") %>
</asp:linkbutton>
</itemtemplate>
</asp:templatecolumn>
<asp:templatecolumn>
<itemtemplate>
<asp:imagebutton id="ImageButtonDocumentDelete" commandname="DeleteFile" runat="server">
ImageUrl="../images/delete.gif" OnClientClick="if(!confirm('message')) return;" />
</asp:imagebutton></itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
</code>
Thanks and regards,
--Tomas Jansson
|
|
|
|
|
mastoj wrote: < ![CDATA
Why did you add this?
mastoj wrote: The codebehind is empty.
The code-behind file should not be emply. (You are using ASP.NET 1x, right? )
At least, it should be something like that ~
namespace WebApplication3<br />
{<br />
using System;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Web;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.HtmlControls;<br />
<br />
public class WebUserControl1 : System.Web.UI.UserControl<br />
{<br />
protected System.Web.UI.WebControls.DataGrid DataGrid1;<br />
<br />
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
}<br />
<br />
#region Web Form Designer generated code<br />
override protected void OnInit(EventArgs e)<br />
{<br />
InitializeComponent();<br />
base.OnInit(e);<br />
}<br />
<br />
private void InitializeComponent()<br />
{<br />
this.Load += new System.EventHandler(this.Page_Load);<br />
<br />
}<br />
#endregion<br />
}<br />
}<br />
I think there are some wrongs in creating the user control. How did you create your usercontrol? What you should do is that just add the Web User Control in your project. Then, add the DataGrid to your user control. that's all you need.
mastoj wrote: I register the control in the web.config
Why do you need that?
|
|
|
|
|
Thanks for you reply.
Michael Sync wrote: < ![CDATA
Why did you add this?
I don't know why that was added, it was added when I added the code.
Michael Sync wrote: The code-behind file should not be emply. (You are using ASP.NET 1x, right? )
My bad, the code-behind is not totally empty. What I meant was that I haven't implemented any functionalty in the code-behind. I am using ASP.NET 2.0.
Michael Sync wrote: I think there are some wrongs in creating the user control. How did you create your usercontrol? What you should do is that just add the Web User Control in your project. Then, add the DataGrid to your user control. that's all you need.
That's exactly how I have created the user control. The thing is that it's the datagrid that is causing problem. If I copy the datagrid to a control that is working that control will disappear in the intellisense.
Michael Sync wrote: I register the control in the web.config
Why do you need that?
I register the control in the web.config instead of registering the control on every aspx page.
|
|
|
|
|
mastoj wrote: I don't know why that was added, it was added when I added the code.
Oh. you mean, codeproject error?
mastoj wrote: I am using ASP.NET 2.0.
I wonder why you used ASP.NET DataGrid (which is old) in ASP.NET 2.0 while there is new control "GridView" available.
mastoj wrote: f I copy the datagrid to a control that is working that control will disappear in the intellisense.
Sorry. I always use GridView in ASP.NET 2.0 project. So, you may also try to use it.
|
|
|
|
|
Michael Sync wrote: Oh. you mean, codeproject error?
I might be an codeproject error. The CDATA tag is probably used when storing the code-block.
Michael Sync wrote: I wonder why you used ASP.NET DataGrid (which is old) in ASP.NET 2.0 while there is new control "GridView" available.
I didn't know that the DataGrid control was old. I will try the GridView instead and see if that works.
Thanks
|
|
|
|
|
mastoj wrote: I might be an codeproject error.
No.. You are not an codeproject error? I was asking whether CDATA is automatically shown when you post your code in CP. (meaning CDATA doesn't actually exist in your code)
mastoj wrote: I didn't know that the DataGrid control was old.
Datagrid is the control that we used to use in ASP.NET 1x project.
mastoj wrote: I will try the GridView instead and see if that works.
All the best, buddy.
|
|
|
|
|
Hi,
How can we set hot key to a linkbutton in asp.net 2.0. I given the Accesskey. But it is not trigerring the linkbuttons's click event as button do. It only giving focus to the linkbutton. Is that anyting more to be done?
Thanks and regards,
Vincy
|
|
|
|
|
vincyjinoy wrote: It only giving focus to the linkbutton
Once you got the focus then you can just hit the enterkey to fire the click event.
If you don't like that way then you can use the Javascript to get the hotkey and fire the click event from client-side.
|
|
|
|
|
Hi all,
Iam using a radwindow from telerik to popup a window inorder to update records in a gridview.
After update iam using window.close() to close the popup and go to the main page. SOMETIMES iam receiving this message when i save
"to display the web page again, Internet Explorer needs to resend the information you've previously submitted"
with a retry and cancel buttons. If i press retry the main page reloads normally. This message is not always popping up.
Any ideas why and how to avoid seeing this message.
thanks in advance.
|
|
|
|
|
samerh wrote: Iam using a radwindow from telerik to popup a window
If you are using radwindow control then you should probably contact with their support team.
|
|
|
|
|
Yes this is correct but i did some search and found out that it is a common problem that many suffers even if not using rad controls. Iam asking for any info about this issue. Thanks again
|
|
|
|
|
samerh wrote: many suffers even if not using rad controls
Can you try with normal window popup? And let us know whether you got this error or not..
The way I understand about this error is that you got this when you try to refresh your page. So, maybe. your Rad control is refreshing its parent page when you close it.
|
|
|
|
|
I have tried it with normal window popup before but i have never faced this issue. However when i googled yesterday i found many developers facing the same issue with normal popup.
For rad popup, yes it is refreshing the main window and this is what i need, but upon refreshing that window the message appears. Through out my investigation for this issue, i read some articles saying that this is a normal act that the explorer do and this is a sort of security. They recommended using redirection (document.location.href) instaed of using window.close. This dont work in my case because i want to close the popup window and redirection keeps my popup open and redirect it and not close it and update the parent.
I know this is a bit crazy but i need a solution if there exists.
thanks for ur reply Michael.
|
|
|
|
|
Hi,
This is from Chandrakanth.
I would like to call a function which is in C#, From JavaScript.
How can i go for that?
Can any one give me repply for this.
Thanks And Regards
chandrakanth
Chandrakanth
|
|
|
|
|
Unfortunately, this isn't very straightforward - js runs in the browser on the client, the C# code on the server. To call anything on the server you'd need to use AJAX to make a call back to the server.
I tend to do this with a callbacks page - straight apsx page, no markup, and a big ol switch statement in page load, which looks for a querystring param which indicates the method in the callbacks file I wanna call...
C# has already designed away most of the tedium of C++.
|
|
|
|
|
document.getElementbyID("IDName").Click()
or
FireEvent
|
|
|
|
|
No, Ko Ye Htut.
The question that he was asking is about calling the server-side function from client-side. It's true that document.getElementbyID("IDName").Click() can invote the server-side click event. but your code won't work if he wants to call the normal server-side function (e.g. public void MyMethod(){ })
YeHtut wrote: FireEvent
You can't just fire the event to invote the server-side method from client-side script.. but it is possible to do with Ajax.
|
|
|
|
|
Hi,
you can try this.
Make Javascript function like this.
function GetClientScript()<br />
{<br />
var str= "My test";<br />
var test = '<%= GetFunction()%>';<br />
alert(test);<br />
}
Here GetFunction() is C# function. This function must return something else this cant work.
Now call this function onClientClick of any asp.net linkbutton or button.
And here you are..
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
U try to do like this.
This is written in code behind file.
public void ServerSideFunction()
{
...
}
This javascript is I was written in Aspx file.
<script>
<%ServerSideFunction;%>
</script>
I already test and work it.
|
|
|
|
|
U try to do like this.
This is written in code behind file.
public void ServerSideFunction()
{
...
}
This javascript is I was written in Aspx file.
<script>
<%ServerSideFunction();%>
</script>
I already test and work it.
|
|
|
|
|
Seem like you are confusing. The server-side script can be written in both class file (e.g. .cs or .vb) and aspx file. But if we want to write the server-side script in aspx file, you have to use <% %>.
So, the way that you showed is just writing the serverside code in aspx file. And it doesn't mean that you are calling the serverside function from client-side ( Javascript or vbscript or etc).
still confused? Okay. Let's say.. I want to call this function ( ServerSideFunction ) from Javascript when I click the button ( input button. not server-control). So, ServerSideFunction() should be invoked only when I click the button. (not on pageload).
How to do that?
|
|
|
|
|
I think so, anyway should be postback and call the Server Side function. Otherwise can not be called the server side function. AJAX is called partial postback and call the server function. So Main page is never refresh.
I know like this. If you know that ow to do with other way, please share it to me.
Thanks for best suggest.
|
|
|
|
|
As I said in this post[^], Ajax is the only solution for this problem. I was pointing out the mistake that you wrote in this post[^].
Thank you.
|
|
|
|
|
Hello,
I have a ASP.NET page and this page has Listboxes and some other controls like label, text boxes and a Hyperlink. When I click the Hyperlink I show up a Panel as a message box.
The issue is as soon as the Panel pops up, The list box behind the Panel is still Visible. But rest of the elements do not. Is there something we can do to sendback this list box
Regards,
Pavas
-----------------------
[http://longjump.com/]
Dynamic business applications that manage and coordinate teams and information
-----------------------
|
|
|
|