|
add attribute to the panel (panel1.attributes.add("onmousemove","javascript:onMouseMoveEvent();")
now you have to create onMouseMoveEvent in javascript and do whatever you want to do as per your login in this fucntion.
-----
|
|
|
|
|
but how can interact from javascript to ASP.NET? For example if i want draw a selection rectangle over a panel i've to handle mousemove from javascript, but i need coordinate referred to the panel position, then handle the drawing above the pannel from onPainEvent, how?
|
|
|
|
|
the coordinates you can get by event.clientX and event.clientY or event.x, event.y, but can you please describe what you are trying to do?
You may look at the following [http://w3schools.com/js/js_examples_3.asp[^] for event object in javascript..
-----
|
|
|
|
|
think having an image on the webpage, i can click over a point of it then drag the mouse to get a selection box, i want do make that
-- modified at 19:48 Monday 12th March, 2007
|
|
|
|
|
I think it is possible, go on the properites window and look at the the lighting sign that's where all the predefined event are delcared.
|
|
|
|
|
no mouse event in property
|
|
|
|
|
Hello
I am creating Dynamic HTML controls using javascript and filling data from ajax.
When post back i cannot access the html controls like text box and combo box using request.form() and those dynamic controls.
How to access dynamically created HTML Controls on Client side on Server side after the page is submited?
Need help Urgently
thanks and regards
Help in need is the help indeed
|
|
|
|
|
AFAIK controls added on client are not accessible on server unless there is way to modify viewstate on client (I don't think you can do it). A better way to achieve something like you want is to create the controls on server and show them or hide them on client as per your logic/requirement.
-----
|
|
|
|
|
Have you assigned id attributes to the elements? Try checking the request sent to the server to check what POST variables its sending (using a tool like Firebug and/or Fiddler)
|
|
|
|
|
Thank you very much for the reply.
Yes i have assigned both name and id attributes for the controls i have created.
But not showing in the key Collections in request.form. It only shows the Items that i created as server controls.
Help in need is the help indeed
|
|
|
|
|
I have a gridview that is populated dynamically based on a drop down by setting the Source to an ObjectDataSource. I want to pull the exact same results in two of the cases from the BLL which pulls from the same get method of one of the table adapters but I want to hide a couple of the columns. Here are four lines of code that I use to bind the gridview but if I try to use GridView3.Columns.RemoveAt(0) or GridView3.Columns.Remove("FirstColumn") I get errors. Can anyone help me with this?
ObjectDataSource1.TypeName = "QAReportsBLL";
ObjectDataSource1.SelectMethod = "GetQARptABCD1";
GridView3.DataSourceID = ObjectDataSource1.ID;
//GridView3.Columns.RemoveAt(1);
GridView3.DataBind();
If I uncomment out the RemoveAt line I get this error...
Error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index .
The table has about 15 columns and I have autogenerate columns set to true.
|
|
|
|
|
AFAIK you have two options:
1. set autogeneratecoulumns = false and then generate the columns dynamically (requires a quite of extra code to change your current approach)
2. set the visible property of column to true or false depending on your logic/requirement (gridview.columns(i).visible = true or false )
-----
|
|
|
|
|
Setting the visible property = false seems to be the best choice but I'm still having issues with that.
Adding this line generated the same error
GridView4.Columns[1].Visible = false;
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
I'm doing this right after databind() and also tried in page_load but I'm not having much luck.
|
|
|
|
|
I'm missing something obvious here as it seems the gridview.columns doesn't hold anything. I got a count of the columns with GridView4.Columns.Count and the count just after I bind it is 0 even though there are many columns on the screen in the gridview. Time for lunch!
|
|
|
|
|
OK, what you have to do is to remove the columns from the datasource i.e. in your datasource you have to select only the coulmns that you need to show.
OR set the autogeneratecolumns = false, use <asp:boundfield id="test" headertext="test" ........="" and="" so="" on="" create="" all="" columns="" like="" this="" in="" your="" html="" page,="" then="" before="" binding="" or="" after="" hide="" the="" that="" you="" don't="" need="" (gridview.columns(i).visible="true/false)..."
<div="" class="ForumSig">-----
|
|
|
|
|
Not sure if this will be your problem but the DataGrid control essentially had a NULL column collection when the AutoGenerateColumns property was true and I believe this behaviour is the same with a GridView.
Essentially you'll not get a columns collection with AutoGenerateColumns set to true.
Rhys
A cult is a religion with no political power.
Tom Wolfe
Behind every argument is someone's ignorance.
Louis D. Brandeis
|
|
|
|
|
how to close modal dialouge box in runtime of the page
eg;
i have popup.aspx a modal dialouge box and it have some vb code
how can i close the popup.aspx page while executing the vb code
thks
|
|
|
|
|
AFAIK modal dialog is on client so cannot close it using vb code. you have to use javascript which you will call on onunload of body something like it..
when you open a dialog open it like
modaldlog = window.showMOdalDi... (where modaldlog is global var to page)
on unload of parent page
if(modaldlog){modaldlog.close();}
-----
|
|
|
|
|
Hi, I Just Started to build this project. Everything is going on well until I came to user login page. I am getting a error msg Error 1 'ASP.login_aspx' does not contain a definition for 'Login1_Authenticate' File: Login.aspx Line 24
May be I need a code to authenticate username and password.
Can someone provide me a good code for this in C#
Database is already created as ASPNETDB.MDF for login user ids.(automatically created through login tool box)
I am using .NET 2005 to develop this.
Thanks
|
|
|
|
|
Sounds like you login control has an event property set but you don't have the method it refers to in your code-behind. Have a look in the markup of the aspx page for Login1_Authenticate
|
|
|
|
|
That ocurrs when you have a defined event handler on a control in the markup, but not defined the function in the codebehind file. For example, if in the markup, you declared <asp:Button OnClick="button_clicked" runat="server"......>] then in the codebehind, you must have declared a function with the following prototype:
<code>
protected void button_clicked (object sender, EvenArgs e).....
</code>
-- modified at 18:51 Monday 12th March, 2007
oops!
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Hi,
I have a web service that must return a URL as a return value from one of its requests. I want this URL to be full, i.e. it should include the same protocol (http or https), the same server name/port name and possibly subdirectory as the URL that was used to call this particular webservice.
Basically, what I would like to achieve is for the Webservice to run code like this:
String strFullUrl = RelativeUrlToFullUrl( String.Format( "~/SomeAspxPage.aspx?param1={0}", param ) );
I initially thought that Page.ResolveUrl would do that for me. However, I don't have access to a Page object within a Web Service, but apparently a System.Web.UI.WebControls.Image also contains a ResolveUrl method. Unfortunately, it only returns a URL relative to the root, but does neither contain the name of the server running the web application, nor the protocol.
Is there a function somewhere in ASP.NET that will do this for me? Doing this on the client side is probably possible, but is going to be less elegant so I would prefer if the webservice could handle this completely.
Regards,
Daníel
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
HttpContext.Current.Request.Url.AbsoluteUri
- walter
|
|
|
|
|
I apologize in advance for the detail in this post...but w/o it, I don't think it will be clear. (code snippet below)
I have been trying to follow an example discussed at http://msdn2.microsoft.com/en-us/library/ms972948.aspx. I have a very similar application - attempting to update a row in a collection of objects bound to a GridView object through an ObjectDataSource. I have 2 methods on a DAL object that I have provided for the ObjectDataSource: getALMPropDataTable() and <b>updateALMProp( int almPropNbr, String almPropNm, String almPropVal)</b>. The getALMPropDataTable() works perfectly, no issues. However, when attempting the Update, a problem arises...
1) Clicking the Edit Button (1st col) of the GridView seems to work OK...and the one column that is editable appears w/ a TextBox - no problem there.
2) In this mode, the Edit Button is replaced w/ an Update and Cancel Button pair as expected - no problem there.
3) When clicking the Update Button, the updateALMProp( int almPropNbr, String almPropNm, String almPropVal) method is called (as expected), however, Trace.Warn messages that I have placed just inside this method reveal the following:
ALMPropVwDAO.updateALMProp() from DAO Layer...
<b>almPropNbr: 0 almPropNm: almPropVal: stuff</b>
Only the 3rd argument is received. No matter what row I attempt to update, I get this same behavior (the 0 value of almPropNbr is always zero regardless of row since this type is Int32 - ie: I don't get the row number as expected). The almPropNm value is empty (it should be name of the property... so that's a problem). Only the value typed into the TextBox on the row in Edit mode actually comes across. The almPropNm is actually the key needed to get the right object of the collection, so consequently no update can performed (the almPropNbr value is technically not required for the update, it is just a row marker for log tracing). If anyone has any ideas, I'd appreciate it...thanks in advance.
Here's the aspx file:
<asp:GridView ID="GridViewALMProp" runat="server" AutoGenerateColumns="False" Width="400px" BackColor="White" BorderColor="#999999"
DataSourceID="ObjectDataSource1" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical"
AllowPaging="True" AllowSorting="True" EmptyDataText="No records found" PagerSettings-Mode="NumericFirstLast" PageSize="5" >
<FooterStyle BackColor="LightGray" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="Gainsboro" ForeColor="Blue" HorizontalAlign="Center" />
<HeaderStyle BackColor="DarkBlue" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#00C000" ForeColor="White" />
<Columns>
<asp:CommandField ShowEditButton="True" ButtonType="Button" />
<asp:BoundField DataField="ALMPropNbr" ReadOnly="true" HeaderText="Number" SortExpression="ALMPropNbr" />
<asp:BoundField DataField="ALMPropNm" ReadOnly="true" HeaderText="Property Name" SortExpression="ALMPropNm" />
<asp:BoundField DataField="ALMPropVal" HeaderText="Property Value" SortExpression="ALMPropVal" />
</Columns>
<PagerSettings Mode="NumericFirstLast" />
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="ALMPropVwDAO" SelectMethod="getALMPropDataTable" UpdateMethod="updateALMProp">
<UpdateParameters>
<asp:Parameter Name="ALMPropNbr" Type="Int32" />
<asp:Parameter Name="ALMPropNm" Type="String" />
<asp:Parameter Name="almPropVal" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>
Here's the method called:
public static void updateALMProp( int almPropNbr, String almPropNm, String almPropVal)
{
HttpContext.Current.Trace.Warn("ALMPropVwDAO.updateALMProp() from DAO Layer...");
HttpContext.Current.Trace.Warn("almPropNbr: " + almPropNbr + " almPropNm: " + almPropNm + " almPropVal: " + almPropVal);
try
{
// get ALM object from Session
ALM alm = (ALM)HttpContext.Current.Session[RequestConstants.ALMObj];
HttpContext.Current.Trace.Warn("ALM from Session: " + alm.ToString());
ALMProp[] almProps = alm.ALMProps;
for (int i = 0; i < almProps.Length; i++)
{
HttpContext.Current.Trace.Warn("almPropNm: " + almPropNm + " | " + "almProps[i].ALMPropPK.ALMPropNm: " + almProps[i].ALMPropPK.ALMPropNm);
// find entry in ALMProp Array and update value
if (almProps[i].ALMPropPK.ALMPropNm.Equals(almPropNm))
{
HttpContext.Current.Trace.Warn ("found ALMProp[] object, i= " + i);
almProps[i].ALMPropVal = almPropVal;
}
}
alm.ALMProps = almProps; // set updated Array back on ALM object
// place ALM object back on Session
HttpContext.Current.Session[RequestConstants.ALMObj] = alm;
}
catch (Exception)
{
}
}
|
|
|
|
|
I got this resolved...I battled this issue for an entire day trying to figure out what the issue was and found that the single attribute DataKeyNames was missing...when you use a GridView to handle SELECTS, this is of course not required. I found the documents at http://msdn2.microsoft.com/en-us/library/aa905796.aspx to be EXTREMELY helpful. Hopefully others will find them helpful as well...
|
|
|
|