EDN Admin
Well-known member
Hello,<br/>
<br/>
I have a grid that contains 3 fields: CityID, BranchID and Edit link.<br/>
<br/>
When i click on the edit link, a web user control page "addFacilty.ascx" is displayed with the right edited items.<br/>
<br/>
"addFacilty.ascx" include 2 dropdown lists ddlCity and ddlBranch and 2 textboxes cityid and branchid<br/>
<br/>
I want that the dropdownlists contain as result:<br/>
<br/>
1-ddlcity: the city having id: cityid.text.tostring()<br/>
2-ddlbranch: the branch having id : branchid.text.tostring();<br/>
<br/>
Note that cityid and branchid are two textboxes with Text value is bind to grid. so it is automaically filled.<br/>
<br/>
My problem now is that when i click on edit link of the grid. cityid and branchid of the webUser control page displays the right item. but when i want to use their values, cityid and branchid are treated as if they are empty.<br/>
<br/>
below is the code of "addFacilty.ascx":<br/>
<br/>
<aspropDownList ID="ddlCity" runat="server" DataSourceID="tblCity" DataTextField="city" DataValueField="cityID" AutoPostBack="true" SelectedValueField=<%#DataBinder.Eval( Container, "DataItem.cityID") %>><br/>
</aspropDownList><br/>
<asp:SqlDataSource ID="tblCity" runat="server" ConnectionString="<% $ ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="select cityID,city from viewCityAdmin </asp:SqlDataSource><br/>
<br/>
<aspropDownList ID="ddlBranch" runat="server" DataSourceID="tblBranch"<br/>
DataTextField="Branch" DataValueField="BranchID <br/>
<br/>
</aspropDownList>
<asp:SqlDataSource ID="tblBranch" runat="server" ConnectionString="<%$ ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="SELECT [BranchID],[Branch] FROM [tblBranch] WHERE
([CityID]=@cityID) <br/>
<SelectParameters><br/>
<asp:ControlParameter Name="cityID" ControlID="ddlCity" PropertyName="SelectedValue" Type="String" /><br/>
</SelectParameters><br/>
</asp:SqlDataSource>
<telerik:RadTextBox ID="cityid" Runat="server" Height="28px" Visible="true" Text=<%# DataBinder.Eval( Container, "DataItem.cityID" ) %> ><br/>
</telerik:RadTextBox>
<telerik:RadTextBox ID="branchid" Runat="server" Height="28px" Visible="true" Text=<%# DataBinder.Eval( Container, "DataItem.BranchID")%> AutoPostBack="true <br/>
</telerik:RadTextBox>
***addFacilty.ascx.cs:
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small protected<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small void<span style="font-size:small <span style="font-size:small Page_Load(<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small object<span style="font-size:small <span style="font-size:small sender,
<span style="color:#2b91af; font-size:small <span style="color:#2b91af; font-size:small <span style="color:#2b91af; font-size:small EventArgs<span style="font-size:small <span style="font-size:small e)<span style="font-size:small <span style="font-size:small
if (cityid.Text.ToString() != "" && branchid.Text.ToString() !="")<br/>
{
<br/>
string selectedIDCity = cityid.Text.ToString();<br/>
tblCity.SelectCommand = "Select * from viewCityAdmin where cityID=@cityid";<br/>
tblCity.SelectParameters.Clear();<br/>
tb
lCity.SelectParameters.Add("cityid", selectedIDCity);<br/>
tblCity.DataBind();
string selectedIDBranch = branchid.Text.ToString();<br/>
tblBranch.SelectCommand = "Select * from tblBranch where BranchID=@branchid";<br/>
tblBranch.SelectParameters.Clear();<br/>
tblBranch.SelectParameters.Add("branchid", selectedIDBranch);<br/>
tblBranch.DataBind();<br/>
} }
thank you in advance.
<br/>
{
View the full article
<br/>
I have a grid that contains 3 fields: CityID, BranchID and Edit link.<br/>
<br/>
When i click on the edit link, a web user control page "addFacilty.ascx" is displayed with the right edited items.<br/>
<br/>
"addFacilty.ascx" include 2 dropdown lists ddlCity and ddlBranch and 2 textboxes cityid and branchid<br/>
<br/>
I want that the dropdownlists contain as result:<br/>
<br/>
1-ddlcity: the city having id: cityid.text.tostring()<br/>
2-ddlbranch: the branch having id : branchid.text.tostring();<br/>
<br/>
Note that cityid and branchid are two textboxes with Text value is bind to grid. so it is automaically filled.<br/>
<br/>
My problem now is that when i click on edit link of the grid. cityid and branchid of the webUser control page displays the right item. but when i want to use their values, cityid and branchid are treated as if they are empty.<br/>
<br/>
below is the code of "addFacilty.ascx":<br/>
<br/>
<aspropDownList ID="ddlCity" runat="server" DataSourceID="tblCity" DataTextField="city" DataValueField="cityID" AutoPostBack="true" SelectedValueField=<%#DataBinder.Eval( Container, "DataItem.cityID") %>><br/>
</aspropDownList><br/>
<asp:SqlDataSource ID="tblCity" runat="server" ConnectionString="<% $ ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="select cityID,city from viewCityAdmin </asp:SqlDataSource><br/>
<br/>
<aspropDownList ID="ddlBranch" runat="server" DataSourceID="tblBranch"<br/>
DataTextField="Branch" DataValueField="BranchID <br/>
<br/>
</aspropDownList>
<asp:SqlDataSource ID="tblBranch" runat="server" ConnectionString="<%$ ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="SELECT [BranchID],[Branch] FROM [tblBranch] WHERE
([CityID]=@cityID) <br/>
<SelectParameters><br/>
<asp:ControlParameter Name="cityID" ControlID="ddlCity" PropertyName="SelectedValue" Type="String" /><br/>
</SelectParameters><br/>
</asp:SqlDataSource>
<telerik:RadTextBox ID="cityid" Runat="server" Height="28px" Visible="true" Text=<%# DataBinder.Eval( Container, "DataItem.cityID" ) %> ><br/>
</telerik:RadTextBox>
<telerik:RadTextBox ID="branchid" Runat="server" Height="28px" Visible="true" Text=<%# DataBinder.Eval( Container, "DataItem.BranchID")%> AutoPostBack="true <br/>
</telerik:RadTextBox>
***addFacilty.ascx.cs:
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small protected<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small void<span style="font-size:small <span style="font-size:small Page_Load(<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small object<span style="font-size:small <span style="font-size:small sender,
<span style="color:#2b91af; font-size:small <span style="color:#2b91af; font-size:small <span style="color:#2b91af; font-size:small EventArgs<span style="font-size:small <span style="font-size:small e)<span style="font-size:small <span style="font-size:small
if (cityid.Text.ToString() != "" && branchid.Text.ToString() !="")<br/>
{
<br/>
string selectedIDCity = cityid.Text.ToString();<br/>
tblCity.SelectCommand = "Select * from viewCityAdmin where cityID=@cityid";<br/>
tblCity.SelectParameters.Clear();<br/>
tb
lCity.SelectParameters.Add("cityid", selectedIDCity);<br/>
tblCity.DataBind();
string selectedIDBranch = branchid.Text.ToString();<br/>
tblBranch.SelectCommand = "Select * from tblBranch where BranchID=@branchid";<br/>
tblBranch.SelectParameters.Clear();<br/>
tblBranch.SelectParameters.Add("branchid", selectedIDBranch);<br/>
tblBranch.DataBind();<br/>
} }
thank you in advance.
<br/>
{
View the full article