|
Thanks for the reply.. I set the property for the gridview pageindex to 1 but the dropdown selected index changed was not availble function.. should I do this way..
.. Page_Load
if isPostback then
if me.dropdownlist1.selectedIndex.CompareTo - 1 then
me.gridwiew1.pageindex(1)
end if
end if
Pls correct my coding, Thks
|
|
|
|
|
hi all,
how to access hidden and visible columns in update event of datagrid?
here i have first column is invisible and and second column is visible.so how can i access the invisible first column and also the visible second column.
any links or suggestions are welcome.
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
All columns, visible or invisible are accessed in the same way programmatically. The invisible columns are just hidden from the design and runtime view, but still exist in the object.
SG
|
|
|
|
|
but i get error accessing them can u just say me the code snippet to access them using vb.net
thanks in advance
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
Hi all,
My apologies if this is an easy one (v.new to this!) but I get the following error when clicking edit a datagrid with a dropdownlist.
'System.IndexOutOfRangeException: StatusID'
In my datagrid I'm calling functions in VB. One to get the status and populate a Dataset & one to get selected index so I can set the initial value of the dropdownlist.
I then have the update sub to declare the dropdownlist and and update the database.
Would anyone be able to point me in the right direction?
Many Thanks
Rob
|
|
|
|
|
Is status ID a valid identifier for the drop down list's selected index property?
Do you really want the selected rows index?
If possible could you post the code so I can see what you are doing please?
Dan
|
|
|
|
|
Hi Dan, thanks for the reply.
Here is my code showing functions to populate the dataset and to get the selected row.
StatusID is the primary key in my access database & thought I'd need to use it to default the value of the dropdownlist to the current value.
Function GetStatus() as DataSet
Dim DBConn as OleDbConnection
Dim DBCommand as OleDbDataAdapter
DBConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("data/Auto_log.mdb") & ";")
DBCommand = New OleDbDataAdapter("SELECT StatusID, Status from Status ORDER BY Status", DBConn)
DBCommand.Fill(DS, "Status")
DBConn.Close()
Return DS
End Function
Function GetSelectedIndex(ByVal StatusID As String) As Integer
'Loop through the DataSet DS
Dim iLoop As Integer
Dim DT As DataTable = DS.Tables("Status")
For iLoop = 0 To DT.Rows.Count - 1
If StatusID = DT.Rows(iLoop)("StatusID").ToString Then
Return iLoop
End If
Next iLoop
End Function
I then declare the ddl in my update subroutine as follows
Dim ddlStatus As DropDownList = FindControl("ddlStatusctrl")
and here is the ddl control from my datagrid:
<asp:TemplateColumn>
<HeaderTemplate>
Status
</HeaderTemplate>
<ItemTemplate>
<%# Container.DataItem("Status") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList id="ddlStatusctrl" runat="server"
DataTextField="Status"
DataValueField="StatusID"
DataSource="<%# GetStatus() %>"
SelectedIndex='<%# GetSelectedIndex(Container.DataItem("StatusID")) %>' />
</EditItemTemplate>
</asp:TemplateColumn>
Rob
|
|
|
|
|
Did anybody know how to help others , may be students, developers, through coding,may be ASP.Net, C#.Net And
have some earning from that. If anybody knows, plz tell me the website or any resource through which i can do that.
Bijay Bhaskar Deo
Thanks & Regard
|
|
|
|
|
|
i am using sessions but it is not deleting the user from database when the user click the browsers 'x' close button.
|
|
|
|
|
Ok try as how bijay said.
Regards,
Satips.
|
|
|
|
|
how to delete a user from database when user click on the browser close button in asp.net
subbarao.k
|
|
|
|
|
What let hte question be specific.
I could not able to get you ?
If the user closes the window the user has to be deleted from the database.
Regards,
Satips.
|
|
|
|
|
i am creating chatroom for that if user by mistake click the close button of the browser instead of clicking the signout, then he must delete from the database plz help me
subbarao
|
|
|
|
|
You can try this with Session. If the Browser closes the close button it will get deleted.
Regards,
Satips.
|
|
|
|
|
When user closes the browwer window the onunload event fires of the body element. Use a function to handle the event raised and in the function send an asynchronous request to the browser using XMLHTTP object and delete the data from the database.
Bijay Bhaskar
Bijay Bhaskar Deo
Thanks & Regard
|
|
|
|
|
send me the code for this please
|
|
|
|
|
or you can hook on the onunload event of the window browser...
<< >>
|
|
|
|
|
hi, Bhaskar if we use onunload event it will fire for every refresh of the page i tried of it also but....
|
|
|
|
|
plz suggest me to disable the close button of the browser
|
|
|
|
|
Try with the Javascript
function winClose()
{
if (confirm("Are you sure you want to navigate away from this page?"))
{
window.close();
}
return false;
}
Then put the following code in the body tag:
Hope this will help you.
Regards,
Satips.
|
|
|
|
|
i am dealing with database how it will work with the javascript
|
|
|
|
|
you can use AJAX concept
<< >>
|
|
|
|
|
Try with Atlas
Regards,
Satips.
|
|
|
|
|
Do one thing- use both onload and onunload event with handler. both the events are fired when the page is loaded , but only onunload event is fired when the page is closed. Use this technique to apply ur logic to segregate a refresh from closing window. Fine
Bijay Bhaskar
Bijay Bhaskar Deo
Thanks & Regard
|
|
|
|